0

I am trying to do a logistic regression in R. I am looking at the relationship between a binary categorical variable (low birthweight) and various other categorical variables (most are binary, some are not--("smoke" and "mat_BMI_cat2")).

When I type in this code, I always get an error.

logit_Mod <-glm(low_bw ~ medical_factors__anemia + medical_factors__eclampsia + m_diabetes + m_hypchron + m_hypreg + smoke + mat_BMI_cat2, data= trainingData, family = binomial(link = "logit"))

I get this error:

Error in family$linkfun(mustart) : Argument mu must be a nonempty numeric vector

I am a bit confused what this error means and where I should go from here.

Thank you!

spaghetti
  • 23
  • 5
  • Most likely one of the variables of your dataset has NA values? Maybe empty values? – AntoniosK Dec 12 '17 at 16:28
  • Have you tried: logit_Mod <-glm(low_bw ~ medical_factors__anemia + medical_factors__eclampsia + m_diabetes + m_hypchron + m_hypreg + smoke + mat_BMI_cat2, data= trainingData, family = binomial(link = "logit"), **na.action=na.exclude**) – Tiffany Dec 12 '17 at 16:30
  • @Tiffany yes, I just tried that and received the same error – spaghetti Dec 12 '17 at 16:39
  • https://stackoverflow.com/questions/35594236/logistic-regression-error-in-r this might help – Leo Ohyama Dec 12 '17 at 17:05
  • It will be very hard to help you without a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – MrFlick Dec 12 '17 at 17:33

0 Answers0