Why will be logistic regression not work after I drop the NIU values in my variable?


#1

I am doing a research project for my quantitative analysis class and I am using a logistic regression in STATA to determine if education attainment has an effect on if someone revied any flu vaccine in the past 12 months. I was informed by my professor that the logistic regression would be a correct test to run on my data and that not using the NIU values would be the right choice, but I can not get the logistic regression to work when NIU is removed. The error I get in STATA is :

. logistic vacflu12m educrec2
outcome does not vary; remember:
0 = negative outcome,
all other nonmissing values = positive outcome
r(2000);


#2

In order for a logistic regression to function properly, your dependent variable (in your case the variable indicating flue vaccination in the past 12 months) needs to be a binary 0/1 variable. Importantly, the codes for VACFLU12M are not simply 0 or 1. VACFLU12M==1 is No, ==2 is Yes, ==3 is both shot and spray (up to the 2015 sample only), ==7 is Refused, ==8 is Not ascertained, and ==9 is Don’t know. You will need to re-code these variables before you run your logistic regression. The same idea applies to EDUCREC2. Other than ==00 NIU, other codes you’ll need to clean up are ==96 Not reported, ==97 Refused, ==98 Not ascertained, and 99 Unknown.