Hello R-Users,
Â
I have one binary dependent variable and a set of independent variables
(glm(formula,â¦,family=âbinomialâ) ) and I am using the function stepAIC
(âMASSâ) for choosing an optimal model. However I am not sure if stepAIC
considers significance properties like Likelihood ratio test and Wald test (see
example below). Â
Â
> y <- rbinom(30,1,0.4)
> x1 <- rnorm(30)
> x2 <- rnorm(30)
> x3 <- rnorm(30)
> xdata <- data.frame(x1,x2,x3)
>
> fit1 <- glm(y~ . ,family="binomial",data=xdata)
> stepAIC(fit1,trace=FALSE)
Â
Call:Â glm(formula = y ~ x3, family = "binomial", data = xdata)
Â
Coefficients:
(Intercept)Â Â Â Â Â Â Â Â Â Â x3Â
   -0.3556      0.8404Â
Â
Degrees of Freedom: 29 Total (i.e. Null);Â 28 Residual
Null Deviance:Â Â Â Â Â 40.38
Residual Deviance: 37.86Â Â Â Â Â Â Â AIC: 41.86
>
> fit <- glm( stepAIC(fit1,trace=FALSE)$formula ,family="binomial")
> my.summ <- summary(fit)
> # Wald Test
> print(my.summ$coeff[,4])
(Intercept)Â Â Â Â Â Â Â Â Â x3
 0.3609638  0.1395215
>
> my.anova <- anova(fit,test="Chisq")
> #LR Test
> print(my.anova$P[2])
[1] 0.1121783
> Â
Â
Is there an alternative function or a possible way of checking if the added
variable and the new model are significant within the regression steps?
Â
Thanks in advance for your help
Â
Regards
Â
Peter-Heinz Fox
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.