Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: graphing a 3 way interaction with mi data
From
Tomeka Davis <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: graphing a 3 way interaction with mi data
Date
Thu, 31 Jan 2013 20:09:36 +0000
Hello -
I am trying to graph a 3 way interaction (1 categorical variable = race, 2 continuous variables = ses and poverty rate) from a logistic regression predicting private school attendance that used -mi- and -svy-. I replicate the basic structure of my data below.
ID Imputation race ses povrate psu strata pweight private
1 1 0 0.28 5.26 2 72 273.3 1
2 1 1 -0.35 48.34 2 54 241.19 0
3 1 0 1.67 4.23 3 8 1014.15 1
4 1 1 -0.98 35.26 1 60 252.8 1
5 1 1 -1.42 50.71 4 70 342.49 0
1 2 0 0.28 5.26 2 72 273.3 1
2 2 1 -0.35 48.34 2 54 241.19 0
3 2 0 1.67 4.23 3 8 1014.15 1
4 2 1 -0.95 35.26 1 60 252.8 1
5 2 1 -1.42 50.71 4 70 342.49 0
1 3 0 0.28 5.26 2 72 273.3 1
2 3 1 -0.35 48.34 2 54 241.19 0
3 3 0 1.67 4.23 3 8 1014.15 1
4 3 1 -0.96 35.26 1 60 252.8 1
5 3 1 -1.42 50.71 4 70 342.49 0
1 4 0 0.28 5.26 2 72 273.3 1
2 4 1 -0.35 48.34 2 54 241.19 0
3 4 0 1.67 4.23 3 8 1014.15 1
4 4 1 -0.97 35.26 1 60 252.8 1
5 4 1 -1.42 50.71 4 70 342.49 0
1 5 0 0.28 5.26 2 72 273.3 1
2 5 1 -0.35 48.34 2 54 241.19 0
3 5 0 1.67 4.23 3 8 1014.15 1
4 5 1 -0.98 35.26 1 60 252.8 1
5 5 1 -1.42 50.71 4 70 342.49 0
I generate the following interactions:
gen race_ses=race*ses
gen ses_povrate=ses*poverty_rate
gen race_ses_povrate=race*ses*poverty_rate (this 3 way interaction is significant and I would like to look at it graphically)
I set up my data for complex survey analysis with the following commands:
mi set flong
mi set M=5
mi svyset psu [pweight=pweight], strata (strata) ||_n, singleunit (certainty)
My logit command is:
mi estimate, saving (miest): svy: logit private race ses povrate race_ses ses_povrate race_ses_povrate
However, I am not clear on how to generate a graph plotting the predicted probability of private school attendance by race, ses, and poverty rate, particularly after the mi command.
-predict- doesn't appear to work with mi nor with mi xeq: predict. Furthermore, in the command line for the graph, how would I specify the 3 way interaction? I assume it would it would start with something like:
mi xeq: twoway (line ????).
I would appreciate any advice.
Thank you.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/