# [R] Linear model

Kingsford Jones kingsfordjones at gmail.com
Thu Feb 12 02:03:41 CET 2009

```On Wed, Feb 11, 2009 at 1:36 PM, kayj <kjaja27 at yahoo.com> wrote:
>
> I want to know how accurate are the p-values when you do linear regression in
> R?
>
> I was looking at the variable x3 and the t=10.843 and the corresponding
> p-value=2e-16 which is the same p-value for the intercept where the t-value
> for the intercept is 48.402.
>
> I tried to calculate the p-value in R and I got 0
>
> x<-2*(1-pt(10.843,2838))
>> x
>  0
>
>

i) the printout says that the value is less than 2e-16

ii) It seems strange to interpret a p-value at that level of precision

iii) you're confusing what is printed vs what is stored

iv) see http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

v) rather than subtracting from 1, use the 'lower.tail' argument to pt:

> 2*pt(10.843,2838,lower=F)
 7.185635e-27

hth,

Kingsford Jones

>
>> G<-lm(y~x1+x2+x3+x4+x5)
>> summary(G)
>
> Call:
> lm(formula = y ~ x1 + x2 +x3 + x4 + x5)
>
> Residuals:
>     Min       1Q   Median       3Q      Max
> -14.3172  -3.2197  -0.2913   2.6938  23.3602
>
> Coefficients:
>            Estimate Std. Error t value Pr(>|t|)
> (Intercept)  22.9461     0.4741  48.402  < 2e-16 ***
> x1           -0.1139     0.3734  -0.305  0.76031
> x2           -0.0405     0.1936  -0.209  0.83437
> x3           2.0165     0.1860  10.843  < 2e-16 ***
> x4           0.5313     0.1782   2.982  0.00289 **
> x5           0.5879     0.1779   3.305  0.00096 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Residual standard error: 4.724 on 2838 degrees of freedom
>  (138 observations deleted due to missingness)
> Multiple R-squared: 0.05279,    Adjusted R-squared: 0.05112
> F-statistic: 31.63 on 5 and 2838 DF,  p-value: < 2.2e-16
>
>
>  Thanks for the help
>
> --
> View this message in context: http://www.nabble.com/Linear--model-tp21963370p21963370.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help