Skip to content

Instantly share code, notes, and snippets.

@stefaneng
Last active August 29, 2015 14:23
Show Gist options
  • Save stefaneng/7bc1f69789a8e928e8ed to your computer and use it in GitHub Desktop.
Save stefaneng/7bc1f69789a8e928e8ed to your computer and use it in GitHub Desktop.
Get significant variables in glm R
# From http://stackoverflow.com/a/16154053/1351718
# x is a 10 x 3 matrix
x = matrix(rnorm(3*10), ncol=3)
y = rnorm(10)
res = glm(y~x)
# ignore the intercept pval
summary(res)$coeff[-1,4] < 0.05
## This answer http://stackoverflow.com/a/16154609/1351718 show how this can be automated to create a new glm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment