Dear All,
Apologies in advance if I am not including all necessary information, this is my first time posting here.
I am trying to plot a cross-level interaction of a categorical and a continuous outcome in a mixed model. I keep getting the following error with marginsplot: "using variable VACANT5 as a factor variable and a regular variable is not supported" and I am not sure how to resolve this.
My code for the model is as follows (note VACANT5 is a dichotomous variable and age is continuous):
mixed BMI age VACANT5 VACANT5#c.age|| CD:age, var covar(un)
I then tried to run margins for the interaction term:
margins VACANT5#c.age
but kept getting the error: "only factor variables and their interactions are allowed"
so I ran it as follows:
margins VACANT5, at (age=(18(2)100))
this worked, but I still can't get it to plot (getting the error listed above).
Any ideas of what I'm doing wrong or how else to get this to work?
Thanks!
Apologies in advance if I am not including all necessary information, this is my first time posting here.
I am trying to plot a cross-level interaction of a categorical and a continuous outcome in a mixed model. I keep getting the following error with marginsplot: "using variable VACANT5 as a factor variable and a regular variable is not supported" and I am not sure how to resolve this.
My code for the model is as follows (note VACANT5 is a dichotomous variable and age is continuous):
mixed BMI age VACANT5 VACANT5#c.age|| CD:age, var covar(un)
I then tried to run margins for the interaction term:
margins VACANT5#c.age
but kept getting the error: "only factor variables and their interactions are allowed"
so I ran it as follows:
margins VACANT5, at (age=(18(2)100))
this worked, but I still can't get it to plot (getting the error listed above).
Any ideas of what I'm doing wrong or how else to get this to work?
Thanks!