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[1] 0> 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.
If you look carefully you will see that the p-value is actually < 2e-16 where the "<" sign is telling you this is an upper limit. For many machines this is the double precision epsilon value:> .Machine$double.eps[1] 2.220446e-16 So there is no pretence to accuracy, other than "the value is postive, but smaller than the least positive value I can represent on this machine". Bill Venables. Bill Venables http://www.cmis.csiro.au/bill.venables/ -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of kayj Sent: Thursday, 12 February 2009 6:36 AM To: r-help at r-project.org Subject: [R] Linear model 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[1] 0> 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 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
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 > [1] 0 > >Some comments: 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)[1] 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 > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >