0
$\begingroup$

I'm working on a logistic regression model; the purpose of the analysis is to identify factors that influence use of an app - the DV being use/no use, and IVs being a couple of numerical and categorical variables.

I want to do a hierarchical regression and add variables step-wise, and compare how much each variable improves the model. At the moment I define multiple models, add a variable for each model, compare the models using an ANOVA and save and compare the (adjusted) R squares in a table:

model1 <- glm(mh_use ~ Q7, data = results_mod, family = "binomial")
model2 <- glm(mh_use ~ Q7 + Q6_4_TEXT, data = results_mod, family = "binomial")
model3 <- glm(mh_use ~ Q7 + Q6_4_TEXT + Q66, data = results_mod, family = "binomial")
anova(model1, model2, model3, test= "Chisq")

rtbl <- matrix(nrow = 3, ncol = 2, byrow = TRUE)
rtbl[1,] <- c(rsq(model1), rsq(model1,adj=TRUE))
rtbl[2,] <- c(rsq(model2), rsq(model2,adj=TRUE))
rtbl[3,] <- c(rsq(model3), rsq(model3,adj=TRUE))

Rather than doing this manually, I was wondering if there is a package/function in R that does this for you and gives the relevant results? And is R squared the best comparison for logistic regression or should I include other measures?

$\endgroup$
0
$\begingroup$

OK, so:

  1. I don't think this is hierarchical logistic regression. The word "hierarchical" is sometimes used to refer to random/mixed effects models (because parameters sit in a hierarchichy). This is just logistic regression.

  2. R square is not a good way to compare logistic regression models. It depends on what you're interested in studying, but a generalized r squared (like Nagelkerke's R squared) are better.

Is your goal here to infer some effect or are you trying to predict something?

$\endgroup$
3
  • $\begingroup$ thanks! the goal is inference, not predict. $\endgroup$
    – user290071
    Jun 30 '20 at 23:24
  • $\begingroup$ OK, goal is inference. What about the model is trying to be "improved"? I'm assuming the generalized R squared? More generally, I think something like AIC might be a good tool here (though I'm personally not a fan of AIC but that is another story). $\endgroup$ Jun 30 '20 at 23:36
  • $\begingroup$ The improvement is to evaluate how much additional variance is explained by adding each variable, so yes something like generalized R squared (or another suitable measure). $\endgroup$
    – user290071
    Jul 1 '20 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.