[R] Extract p-value from linear model
(Ted Harding)
Ted.Harding at manchester.ac.uk
Thu Jan 7 15:39:50 CET 2010
On 07-Jan-10 14:15:07, Trafim Vanishek wrote:
> Dear all,
>
> I have the following question.
> Is it possible in R to call for the p-value directly in a model like
> this
>
> a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
>
> summary(lm(a~(b+0)))
summary(lm(a~(b+0)))
# [...]
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# b 0.90777 0.07134 12.72 4.67e-07 ***
# ---
summary(lm(a~(b+0)))$coef[,4]
# [1] 4.665795e-07
> or even in this
> a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
>
> summary(lm(a~b))
>
> to call the p-values directly for every estimated parameter.
> Thanks a lot for the help!
summary(lm(a~b))
# [...]
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 7.7957 2.1661 3.599 0.00699 **
# b -0.6230 0.4279 -1.456 0.18351
# ---
summary(lm(a~b))$coef[,4]
# (Intercept) b
# 0.006992306 0.183511560
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 07-Jan-10 Time: 14:39:46
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list