Bookmark and Share

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: Problem probing interaction


From   Kris Anderson <[email protected]>
To   [email protected]
Subject   st: Problem probing interaction
Date   Tue, 11 Jan 2011 13:20:26 -0800

Hi, all.

I am trying to plot a 2-way continuous vs continuous interaction in logistic regression using multiple imputation. I have successfully done this for 3-way interactions using different code. I found this code on the site but can't get it to run.

mim: logistic drinker gradeR sexR his_latR white C_ndmot C_socmot C_copemot C_enhmot C_confmot int_nsoc int_ncope int_nenh int_nconf gen y1 = _b[C_socmot]*(-1.18) + _b[C_ndmot]*C_ndmot + _b[int_nsoc]*(-1.18)*C_ndmot + _b[_cons] gen y2 = _b[C_socmot]*(0) + _b[C_ndmot]*C_ndmot + _b[ int_nsoc]*(0)*C_ndmot + _b[_cons] gen y3 = _b[C_socmot]*(1.18) + _b[C_ndmot]*C_ndmot + _b[ int_nsoc]*(1.18)*C_ndmot + _b[_cons]
sort C_socmot
twoway (line y1 ) (line y2 C_socmot) (line y3 C_socmot), name(SocmotxNdm, replace)
gen p1 = exp(y1)/(1+exp(y1))
gen p2 = exp(y2)/(1+exp(y2))
gen p3 = exp(y3)/(1+exp(y3))
twoway (line p1 C_socmot) (line p2 C_socmot) (line p3 C_socmot), name(SocmotxNdm, replace)

I am getting an error message after the gen y1 line saying that "no variables defined." The code looks like my sample so am a bit confused.

Thanks,
Kris
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index