Plotting odds ratio vs. continuous variable in stata

时间:2017-04-10 01:42:25

标签: plot stata logistic-regression

Is there any way I can plot a graph like this in stata:

linear OR of age;

image

The odds ratio is from a logistic regression.

I want to plotting the odds ratio of every value of the continuous variable and set reference as the lowest value. "margins" seems meet my need, however, I have to list all values of the continuous variable so that it can calculate the OR. Another question is I want plot this graph on another graph plotted by "twoway", and I'm not sure how to do this in stata.

1 个答案:

答案 0 :(得分:1)

您基本上回答了自己的问题,这是marginsmarginsplot一起使用的问题。详细信息描述为in this post,但您可以执行以下操作:

logit outcome age, or
margins, at(age=(38(1)82)) expression(exp(xb()))
marginsplot

关于第二个问题,请查看marginsplot documentation。与其他stata图表类似,它可以与其他图表结合使用。