i'm searching way 1 p-value describes goodness of fit glm-model. here modified example lm
manpage:
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) conf<- c(rnorm(mean=-1, sd=1, n=10), rnorm(mean=1, sd=1, n=10)) group <- gl(2,10,20, labels=c("ctl","trt")) weight <- c(ctl, trt) lm.d9 <- lm(weight ~ group + conf)
with summary(lm.d9)
1 gets
call: lm(formula = weight ~ group + conf) residuals: min 1q median 3q max -1.17619 -0.40373 -0.05262 0.24987 1.40777 coefficients: estimate std. error t value pr(>|t|) (intercept) 4.97416 0.25153 19.775 3.6e-13 *** grouptrt -0.23724 0.41117 -0.577 0.572 conf -0.07044 0.13725 -0.513 0.614 --- signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 residual standard error: 0.7111 on 17 degrees of freedom multiple r-squared: 0.08722, adjusted r-squared: -0.02017 f-statistic: 0.8122 on 2 , 17 df, p-value: 0.4604
if id same glm
glm.d9 <- glm(weight ~ group + conf) summary(glm.d9)
i get
call: glm(formula = weight ~ group + conf) deviance residuals: min 1q median 3q max -1.17619 -0.40373 -0.05262 0.24987 1.40777 coefficients: estimate std. error t value pr(>|t|) (intercept) 4.97416 0.25153 19.775 3.6e-13 *** grouptrt -0.23724 0.41117 -0.577 0.572 conf -0.07044 0.13725 -0.513 0.614 --- signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (dispersion parameter gaussian family taken 0.5056514) null deviance: 9.4175 on 19 degrees of freedom residual deviance: 8.5961 on 17 degrees of freedom aic: 47.869 number of fisher scoring iterations: 2
lm
has f-statistics summary whole model, glm
has not. again question: how can 1 p-value glm model describes fit?
thanks
you can calculate f statistics this:
glm.d9 <- glm(weight ~ group + conf) glm.0 <- glm(weight ~ 1) anova(glm.d9, glm.0, test="f") # analysis of deviance table # # model 1: weight ~ group + conf # model 2: weight ~ 1 # resid. df resid. dev df deviance f pr(>f) # 1 17 8.5868 # 2 19 9.4175 -2 -0.8307 0.8223 0.4562
see ?anova.glm
details , other tests available.
Comments
Post a Comment