[Please use the subject line!] In the help page for summary.lm, the "Value" section says that the returned object has a component called "fstatistic", which has the F-statistic and the associated numerator and denominator degrees of freedom. You can get the p-value by something like: fstat <- summary(speciallinearmodel)$fstatistic pval <- pf(fstat[1], fstat[2], fstat[3], lower.tail=FALSE) HTH, Andy> -----Original Message----- > From: joerg-burmester at gmx.net [mailto:joerg-burmester at gmx.net] > Sent: Monday, July 07, 2003 7:50 AM > To: R-help at stat.math.ethz.ch > Cc: amaitour at pasteur.fr; bitwrit at ozemail.com.au; > p.dalgaard at biostat.ku.dk; gregor.gawron at rmf.ch; > mditzen at zedat.fu-berlin.de > Subject: [R] (no subject) > > > hi, > > can anyone help me about the simple data probability-value of > the F-test, respectively p-value, shown in the summary of a > linear model? somehow i can not retrieve this data out of R+ > into my sql-dataset. i can get all other data shown with the command: > summary(speciallinearmodel) - will have a gui screen > > Call: > lm(formula = y21 ~ x4 + x18 + x4:x18, data = > clustertransformationstabelle) > Residuals: > Min 1Q Median 3Q Max > -0.20915 -0.07354 -0.01823 0.04414 0.45191 > Coefficients: > Estimate Std. Error t value Pr(>|t|) > (Intercept) -0.003613 0.043142 -0.084 0.933450 > x4 0.142373 0.113036 1.260 0.211057 > x18 0.250261 0.127277 1.966 0.052314 . > x4:x18 0.818618 0.218541 3.746 0.000315 *** > --- > Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > Residual standard error: 0.1305 on 91 degrees of freedom > Multiple R-Squared: 0.7865, Adjusted R-squared: 0.7795 > F-statistic: 111.7 on 3 and 91 DF, p-value: < 2.2e-16 > > but the desired p-value like in this example p-value: < > 2.2e-16, i somehow can not retrieve by any command like > attributes(speciallinearmodel). has anyone an idea to get > this shown but not selectable respectively exportable p-value? > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, ...{{dropped}}
Peter Dalgaard BSA
2003-Jul-07 12:58 UTC
P-value for F from summary.lm (was RE: [R] (no subject))
"Liaw, Andy" <andy_liaw at merck.com> writes:> [Please use the subject line!] > > In the help page for summary.lm, the "Value" section says that the returned > object has a component called "fstatistic", which has the F-statistic and > the associated numerator and denominator degrees of freedom. You can get > the p-value by something like: > > fstat <- summary(speciallinearmodel)$fstatistic > pval <- pf(fstat[1], fstat[2], fstat[3], lower.tail=FALSE)Also, note that this gets printed using format.pval(), which avoids misleading printouts if the p value underflows to zero:> format.pval(0)[1] "< 2.22e-16"> > but the desired p-value like in this example p-value: < > > 2.2e-16, i somehow can not retrieve by any command like > > attributes(speciallinearmodel). has anyone an idea to get > > this shown but not selectable respectively exportable p-value?-- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907