Suppose I am going to do a univariate logistic regression on several independent variables, like this:
mod.a <- glm(x ~ a, data=z, family=binominal("logistic"))
mod.b <- glm(x ~ b, data=z, family=binominal("logistic"))
I did a model comparison (likelihood ratio test) to see if the model is better than the null model by this command
1-pchisq(mod.a$null.deviance-mod.a$deviance, mod.a$df.null-mod.a$df.residual)
Then I built another model with all variables in it
mod.c <- glm(x ~ a+b, data=z, family=binomial("logistic"))
In order to see if the variable is statistically significant in the multivariate model, I used the lrtest
command from epicalc
lrtest(mod.c,mod.a) ### see if variable b is statistically significant after adjustment of a
lrtest(mod.c,mod.b) ### see if variable a is statistically significant after adjustment of b
I wonder if the pchisq
method and the lrtest
method are equivalent for doing loglikelihood test? As I dunno how to use lrtest
for univate logistic model.
epicalc
was removed (source). An alternative could belmtest
. $\endgroup$ – Martin Thoma Dec 17 '15 at 13:51