[R] extract the p value of F statistics from the lm class
Thomas Petzoldt
thpe at simecol.de
Sun Apr 5 13:52:38 CEST 2009
Hi,
what about the following:
## some test data
x <- 1:10
y <- x + rnorm(x)
## model and summary
m <- lm(y~x)
sm <- summary(m)
sm
# str(sm)
# sm$fstatistic
## and now: the manual case
1 - pf(sm$fstatistic[1], sm$fstatistic[2], sm$fstatistic[3])
Hope it helps, ThPe
tedzzx schrieb:
> Dear R users
>
> I have run an regression and want to extract the p value of the F
> statistics, but I can find a way to do that.
>
> x<-summary(lm(log(RV2)~log(IV.m),data=b))
>
> Call:
> lm(formula = log(RV2) ~ log(IV.m), data = b[[11]])
>
> Residuals:
> Min 1Q Median 3Q Max
> -0.26511 -0.09718 -0.01326 0.11095 0.29777
>
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) -0.3059 0.1917 -1.595 0.121
> log(IV.m) 0.9038 0.1065 8.488 1.38e-09 ***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Residual standard error: 0.1435 on 31 degrees of freedom
> Multiple R-squared: 0.6991, Adjusted R-squared: 0.6894
> F-statistic: 72.04 on 1 and 31 DF, p-value: 1.379e-09
>
> names(x)
> [1] "call" "terms" "residuals"
> [4] "coefficients" "aliased" "sigma"
> [7] "df" "r.squared" "adj.r.squared"
> [10] "fstatistic" "cov.unscaled"
>
> x$fstatistic
> value numdf dendf
> 72.04064 1.00000 31.00000
>
> But can not find the p value of F statistics.
>
> Thanks
>
> Ted
>
>
>
More information about the R-help
mailing list