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: Nice Margins programming challenge (apologies for reposts)
From
Steve Kay <[email protected]>
To
[email protected]
Subject
st: Nice Margins programming challenge (apologies for reposts)
Date
Fri, 3 Dec 2010 18:34:28 +0000
Im 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,
family(binomial) link(logit)
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 the 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
(possible euphism for can't). Hopefully some bright public spirited
person can do it for me or show how it can be done even more
efficiently.
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/