Statalisters, I am trying to plot ORs from a logistic model that has one continuous predictor variable, the square of that variable, one factor variable (with 3 levels) and the interaction between those. For example:
logit dx c.var1##c.var1##i.var2, or [/INDENT][INDENT=3]lincomest `i'*var1 + `i2'*c.var1#c.var1, eform(OR) [/INDENT][INDENT=3]est sto var2_0_`i'[/INDENT][INDENT=2]logit dx c.var1##c.var1##i.var2, or [/INDENT][INDENT=3]lincomest `i'*var1 + `i2'*c.var1#c.var1 + i1.var2 + `i'*i1.var2#c.var1 + `i2'*i1.var2#c.var1#c.var1, eform(OR)
est sto var2_1_`i'[/INDENT][INDENT=2]logit dx c.var1##c.var1##i.var2, or [/INDENT][INDENT=3]lincomest `i'*var1 + `i2'*c.var1#c.var1+ i2.var2 + `i'*i2.var2#c.var1 + `i2'*i2.var2#c.var1#c.var1, eform(OR)
est sto var2_2_`i'[/INDENT]
Thanks,
Amanda
logit dx c.var1##c.var1##i.var2, orI would like to use the coefplot command to plot the ORs for a given set of x values (i.e. 100(100)1000), similar to how a marginsplot would look (I cannot use margins because this is a case-control study). I have tried manipulating coefplot in many different ways to achieve this, but, it will either not plot it quite right or it will return an error of some sort. The code I am using to store the estimates is something like this:
[INDENT=2]local i2 = (`i')^2
forvalues i = 100(100)1000{
logit dx c.var1##c.var1##i.var2, or [/INDENT][INDENT=3]lincomest `i'*var1 + `i2'*c.var1#c.var1, eform(OR) [/INDENT][INDENT=3]est sto var2_0_`i'[/INDENT][INDENT=2]logit dx c.var1##c.var1##i.var2, or [/INDENT][INDENT=3]lincomest `i'*var1 + `i2'*c.var1#c.var1 + i1.var2 + `i'*i1.var2#c.var1 + `i2'*i1.var2#c.var1#c.var1, eform(OR)
est sto var2_1_`i'[/INDENT][INDENT=2]logit dx c.var1##c.var1##i.var2, or [/INDENT][INDENT=3]lincomest `i'*var1 + `i2'*c.var1#c.var1+ i2.var2 + `i'*i2.var2#c.var1 + `i2'*i2.var2#c.var1#c.var1, eform(OR)
est sto var2_2_`i'[/INDENT]
}Please let me know if this is even possible, and if so, how to do it.
Thanks,
Amanda
Comment