I have estimated the following logistic regression model:

model_4<-glm(formula = LIHS ~ wave7+ wave8 + wave9 + wave10 + wave11 + wave12 + wave13 + wave14 + wave15 + wave16 + wave17 + wave18 + wave19 + wave20 + wave21 + hhpers + allatsi + allmigrant + allpoorenglish +allhlth + allnesb + allnotempl + allfinstress + under15 +all1530 +all3164 +all65plus +hhrural +hhremote + allwfh + hhtypeblone + hhdec_sad,family = binomial (link ="logit"), data = affordable_v3)

When I run margins command I am able to obtain marginal effects and their standard errors for this model

summary(margins(model= model_4, data=affordable_v3, variables =c("hhinc", "hhpers", "allatsi","allmigrant", "allpoorenglish", "allhlth", "allnesb", "allnotempl", "allfinstress", "under15", "all1530", "all3164", "all65plus", "hhrural", "hhremote", "alledlow", "allwfh", "hhtypeblone", "hhdec_sad")), type="response")

However, when I add interaction terms to this model, I am no longer able to get the estimates of standard errors for particular marginal effects

model_4_inter<-glm(formula = LIHS ~ wave7+ wave8 + wave9 + wave10 + wave11 + wave12 + wave13 + wave14 + wave15 + wave16 + wave17 + wave18 + wave19 + wave20 + wave21 + allmigrant+ hhinchhtypeblone+ hhincallnotempl+ hhtypeblonewave2021 + hhpersallfinstress + allpoorenglish + hhincallhlth +all65pluswave2021 + hhincall3164 + hhincall1530 + hhincunder15 + hhruralwave2021 + hhinc*hhremote + allwfh + hhdec_sad, family = binomial (link ="logit"), data = affordable_v3)

summary(margins(model= model_4_inter, data=affordable_v3, variables =c("hhinc", "hhpers", "allatsi","allmigrant", "allpoorenglish", "allhlth", "allnesb", "allnotempl", "allfinstress", “all1530", "all3164", "all65plus", "hhrural", "hhremote", "alledlow", "allwfh", "hhtypeblone", "hhdec_sad")), type="response")

Has anyone had similar issues with the margins package? How can I get standard errors on marginal effects for logistic regression model including interaction terms?

0

There are 0 best solutions below