Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

Re: st: Adjusted Prevalence from Logistic models

 From Phil Clayton To statalist@hsphsun2.harvard.edu Subject Re: st: Adjusted Prevalence from Logistic models Date Wed, 24 Oct 2012 22:55:07 +1100

```For such a simple model you could also consider graphing the predicted probability of beta blocker use against age for each of the four groups defined by rural dwelling & sex.

logistic BB age i.sex i.rural
margins sex#rural, at(age=(50(5)90))
marginsplot, noci legend(pos(6) row(1)) plotopts(msymbol(none))

Obviously you can change the age range to suit your particular dataset.

Phil

On 24/10/2012, at 7:18 PM, Richard Williams <richardwilliams.ndu@gmail.com> wrote:

> At 01:18 AM 10/24/2012, Dean Eurich wrote:
>> Hi all,
>>
>> A simple question. If I run a logistic model:
>>
>> logistic BB age sex rural
>>
>> I get the OR for the effect of rural (which is a flag for rural=0 or urban=1 dwelling) on the use of beta blockers (medication used to treat cardiovascular disease).
>>
>> A reviewer has asked for us to present the adjusted prevalence for the use of BB by rural and urban status. I am not to sure how to do this.
>>
>> I assume I could use the 'margin' command.
>>
>> So would it be as simple as
>>
>> margins rural, atmeans
>>
>> (Although I realize I could do it as specific levels of sex and age as well)
>>
>> Thanks
>>
>> Dean
>
> I'm not totally sure how you want to adjust. But if you want to use -margins- you should use factor variable notation, e.g.
>
> logistic BB age i.sex i.rural
> margins rural, atmeans
>
> In general, I am not crazy about the atmeans option, and I especially don't like it when you have a variable like sex in the model. You'll be plugging in something like .5 for sex (the average person is half male, half female?) I'd rather use the default -asobserved- or plug in specific values or ranges of values for the other variables. For some highlights of what you can do with margins, see
>
> http://www.nd.edu/~rwilliam/stats/Margins01.pdf
>
> As a sidelight, when you say rural=0 or urban=1, that sort of sounds to me like heads I win, tails you lose. Aren't rural=0 and urban=1 the same thing?
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME:   (574)289-5227
> EMAIL:  Richard.A.Williams.5@ND.Edu
> WWW:    http://www.nd.edu/~rwilliam
>
> *
> *   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/

*
*   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/
```