You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing mismatched labels between margins(foo) and plot(margins(foo)), in this case for a logit (no interactions). I hope I'm not doing something wrong. Reproduceable minimal example below. The issue seems to arise when the variables in the fitted model appear in a different order than they do in the data frame.
====================================
Please specify whether your issue is about:
a possible bug
a question about package functionality
a suggested code or documentation change, improvement to the code, or feature request
Code!
library("margins")
set.seed(7222009)
df<-data.frame(X1=rbinom(400,1,0.5),
X2=runif(400,0,1),
X3=rbinom(400,1,0.2))
df$Y<-rbinom(400,1,plogis(1*df$X1+3*df$X2-3*df$X3))
hat<-glm(Y~X1+X2+X3,df,family="binomial")
margins(hat)
plot(margins(hat)) # <- works OKhat2<-glm(Y~X3+X2+X1,df,family="binomial")
margins(hat2)
plot(margins(hat2)) # <- mismatches labels to AMEs## session info for your system
sessionInfo()
The text was updated successfully, but these errors were encountered:
Hi -
I'm seeing mismatched labels between margins(foo) and plot(margins(foo)), in this case for a logit (no interactions). I hope I'm not doing something wrong. Reproduceable minimal example below. The issue seems to arise when the variables in the fitted model appear in a different order than they do in the data frame.
Thanks,
-- CZ ([email protected], @PrisonRodeo)
====================================
Please specify whether your issue is about:
Code!
The text was updated successfully, but these errors were encountered: