Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Nice Margins programming challenge


From   Steve Kay <arw.steve@googlemail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Re: Nice Margins programming challenge
Date   Sat, 4 Dec 2010 15:46:53 +0000

Already looked at the ucla website before posting - unfortunately
doesn't cover my circumstances.

On Saturday, 4 December 2010, Robert Duval <rduval@gmail.com> wrote:
> I think the answer can be found in here
>
> http://www.ats.ucla.edu/stat/stata/faq/
>
>
>> Date: Fri, 3 Dec 2010 17:52:20 -0000
>> From: Stephen Kay <stephen.kay@adelphigroup.com>
>> Subject: st: Nice Margins programming challenge
>>
>> This message is in MIME format. Since your mail reader does not understand
>> this format, some or all of this message may not be legible.
>>
>> - ------_=_NextPart_001_01CB9312.D55BA0FC
>> Content-Type: text/plain
>>
>> I'm using MFP command combined with xtgee to model a fractional logistic
>> model (dependent variable is a percent varying from 0 to 100% inclusive;
>> patients are clustered within a doctor). Command is:
>>
>>
>>
>>                 mfp,select(0.05): xtgee actimpair  age  bmi comorbidities
>> female
>>
>>
>>
>> The mfp command creates new tranformed age variables (lets call them age1
>> and age2) based on the fractional polynomial terms it thinks best (and very
>> kindly gives the formula so they are easy to reproduce).
>>
>>
>>
>> I want to run Stata 11's Margins command to give predictions on the
>> dependent variable with 95% CI's across a large range of age values.
>>
>>
>>
>> It looks (to me at least) that I need to program a routine that for every
>> age value needing a prediction:
>>
>> (1)   Generate the appropriate age1 and age2  values
>>
>> (2)   Input these into the margins command using the "at" option
>>
>> (3)   Store/append the resultant prediction plus SE, plus relevant age value
>> into a matrix holding all such results.
>>
>> (4)   Compute the 95% CI's for the predictions and store them in the
>> relevant place in the matrix mentioned in (3).
>>
>>
>>
>> Final tasks after looping through all such ages populating the matrix
>> holding relevant results is to convert the matrix into data and graph from
>> it (this task at least I can do).
>>
>>
>>
>> I don't program often enough to accomplish the steps above quickly.
>> Hopefully some bright, public spirited spark can do it for me or show how it
>> can be done even more efficiently. To be honest I'm surprised I've not found
>> any previous posts or web files on this as I'd have thought quite a lot of
>> people would want to do this sort of thing.
>>
>>
>>
>> Any help much appreciated.
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Steve
>>
>
> *
> *   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/
>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index