I am analyzing the interaction of two categorical independent variables (x1 (insurance) and x2 (ethnicity)) on two dichotomous dependent variables y1 (mental health care) and y2 (physical health care). My current code is:
logistic y1 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
margins if e(sample), dydx(x1) at(x2=(1 2 3 4 5 6)) atmeans post
logistic y2 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
margins if e(sample), dydx(x1) at(x2=(1 2 3 4 5 6)) atmeans post
And this provides me with the average marginal effects of insurance (x1) for each of the six categories of ethnicity (x2). Then, I am using suest to see if these AME's are statistically significantly different between the model predicting mental health care and the model predicting physical health care:
logistic y1 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
est store MODEL1
logistic y2 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
est store MODEL2
suest MODEL1 MODEL2
The trouble is, since I use an interaction effect in the logistic regression model, I am having trouble with the syntax for statistical significance tests that would compare the average marginal effects (AME's) of insurance (x1) for each category of ethnicity (x2) across model 1 and model 2. I can compare different coefficients across the two models using the test command in STATA, but suest just reports the coefficients for x1, x2, and x1##x2 and that isn't really what I want to compare. I've tried using margins after suest to no avail:
margins, dydx(x1) predict(MODEL1) atmeans
I get the following error:
Warning: cannot perform check for estimable functions.
option MODEL1 not allowed
Any suggestions for moving forward from here would be much appreciated!
logistic y1 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
margins if e(sample), dydx(x1) at(x2=(1 2 3 4 5 6)) atmeans post
logistic y2 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
margins if e(sample), dydx(x1) at(x2=(1 2 3 4 5 6)) atmeans post
And this provides me with the average marginal effects of insurance (x1) for each of the six categories of ethnicity (x2). Then, I am using suest to see if these AME's are statistically significantly different between the model predicting mental health care and the model predicting physical health care:
logistic y1 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
est store MODEL1
logistic y2 i.x1##i.x2 ///
m1 m2 m3 if sample1==1, or nolog
margins x1##x2if e(sample), atmeans
est store MODEL2
suest MODEL1 MODEL2
The trouble is, since I use an interaction effect in the logistic regression model, I am having trouble with the syntax for statistical significance tests that would compare the average marginal effects (AME's) of insurance (x1) for each category of ethnicity (x2) across model 1 and model 2. I can compare different coefficients across the two models using the test command in STATA, but suest just reports the coefficients for x1, x2, and x1##x2 and that isn't really what I want to compare. I've tried using margins after suest to no avail:
margins, dydx(x1) predict(MODEL1) atmeans
I get the following error:
Warning: cannot perform check for estimable functions.
option MODEL1 not allowed
Any suggestions for moving forward from here would be much appreciated!
Comment