I was trying to run a binary logistic regression with interaction effect between two variables with binary category.
My R code is below:
md1 <- glm(Diabetes_Cate_3 ~ Age_Years+factor(Gender)+
Education_Year+factor(Marital_Status)+
factor(Currently_Working)+factor(Smoked)+
MUAC+BMI+factor(Wealth_Index)+
Area*Year, family=binomial(link="logit"),
data=Diabetes1)
Here:
Dibetes_Cate_3 = "Diabetic" and "Nondiabetic"
Area = "Rural" and "Urban"
Year = "2011" and "2017"
I was trying to see the interaction of the risk of diabetes between Area and yeear adjusting all other factors.
While running interactionR function from the interactionR packages I was getting the follwoning error.
table_object = interactionR(md1, exposure_names = c("Area", "Year" ),
ci.type = "mover",
ci.level = 0.95, em=FALSE, recode = T)
Error in `[[<-.data.frame`(`*tmp*`, beta1, value = logical(0)) :
replacement has 0 rows, data has 8144
I will be grateful if anyone help fix this problem.
Thanks and Regards