Description Usage Arguments Value Author(s) Examples
Extracts the p-value from lm(). Source: Stephen Turner (http://www.gettinggeneticsdone.com/2011/01/rstats-function-for-extracting-f-test-p.html) In short, lmp extracts the F-statistic from the lm output and calculates the p-value based on the F-distribution.
1 | lmp(modelobject)
|
modelobject |
lm output |
A p-value for a linear regression as obtained through lm()
Stephen Turner
1 2 3 4 5 6 7 8 9 10 11 12 13 | set.seed(42)
n=20
d=data.frame(x1=rbinom(n,2,.5), x2=rbinom(n,2,.5))
d=transform(d, y=x1+x2+rnorm(n))
#fit the linear model
fit=lm(y ~ x1 + x2, data=d)
summary(fit) #shows that the F-test is 0.006641
names(summary(fit)) #can't access that p-value using this!
names(fit) # this doesn't work either
lmp(fit) # uses the above function to capture the F-test p-value.
#Source: http://www.gettinggeneticsdone.com/2011/01/rstats-function-for-extracting-f-test-p.html
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.