5
$\begingroup$

I am trying to find a way to do Nested Logistic Regression in R that fits my needs. I have a very large data set with almost 200 variables available. I have found my "best" model and it contains 12 of these variables. I am aware of the problems of using 12 variables in logistic regression and don't want to cover those here. I am using the model to predict the probability a student will drop out of high school. The dataset I'm using that includes the students I am predicting the probability for has some missing data. So for example say my model is:

Dropout ~ AttendanceRate + Enrollments + AgeDiff + Race + Absences

Now say it is not known for a particular student how many Absences he has had. I am using the predict function to find the dropout probabilities from my model. If one of the variables is missing or "NA" then there is no predicted probability as it is NA. To fix this problem I want to use Nested logistic regression. So for a student with a missing value in "Absences" the model would be

Dropout ~ AttendanceRate + Enrollments + AgeDiff + Race

I am currently using the glm function to do my logistic regression. I understand it cannot do nested logistic regression. So how do I do Nested Logistic regression from my full model so that I can predict a students dropout probablity no matter which variable or variables may be missing. I realize using Nested models will hurt the strength of my model for prediction purposes but I am willing to sacrifice that for my purposes.

Any Suggestions?

$\endgroup$
  • 1
    $\begingroup$ "Nested logit" usually means something quite different from what you are proposing; this might be why you aren't finding what you're looking for. $\endgroup$ – Charlie Aug 31 '12 at 17:09
  • 2
    $\begingroup$ I find it very unfortunate that terms get used in different ways; it makes it harder for people to understand these topics & communicate w/ each other. You seem to be using "nested" in the sense of nested model tests (checking if a version of your model w/o a covariate fits significantly worse than the full model), whereas more typically, "nested logit" might refer to something like modeling the probability of students passing a test, when those students are nested w/i classes, which are nested w/i schools, etc. It's worth being clear on this distinction b/c it can be quite slippery. $\endgroup$ – gung Aug 31 '12 at 19:18
  • 2
    $\begingroup$ On a different note, I am not aware of a problem w/ using 12 variables in logistic regression. Can you clarify what you are referring to? $\endgroup$ – gung Aug 31 '12 at 19:21
  • $\begingroup$ In this case, as can be determined from my example above, I am referring to "nested Model tests". The problem I'm referring to with 12 variables is overfitting but obviously I'm not worried about that because I have no problem using 12 or more variables. I am now starting to think that replacing my missing values with one of the methods of doing so might be a better way to go, such as replacing the missing values with the median or mode(if it is a categorical variable). $\endgroup$ – Eric Sep 5 '12 at 14:19
2
$\begingroup$

I suggest looking into multiple imputation for the missing data. Like other methods, this relies on them being missing at random, but may perform well even if they are missing not at random.

In R one package that does this is mice.

$\endgroup$
1
$\begingroup$

What you're using is called a complete factor approach to handling missing data for prediction. It's not the best way, but it's certainly easy. Are you fitting submodels using all available data or only subsets with missing data in the omitted variables?

Doing this with one model is not possible. You'll have to do it the brute force way: fit each necessary submodel, then inspect rows of data to match to your dataset and select fitted values from each model.

$\endgroup$
  • $\begingroup$ The Brute force method is what I'm trying to get away from, I have thousands of students to find probabilities for so there's no way for me to do each one. I haven't actually found my sub models yet, looking for the easiest way to do this before I do that. Right now it appears there would be so many submodels that another method may be better. $\endgroup$ – Eric Aug 31 '12 at 16:43
  • 1
    $\begingroup$ I don't mean visual inspection, use a loop to detect which missing variables you have and select which one you'd like to use. It should be fairly easy to determine which combinations of factors have missing variables. R has some convenience functions for fitting nested models this way. Check out the help pages around "dropterm" and related functions. $\endgroup$ – AdamO Aug 31 '12 at 18:26

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.