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]
Re: st: Looping with regression controls
From
Steve Samuels <[email protected]>
To
[email protected]
Subject
Re: st: Looping with regression controls
Date
Wed, 29 Feb 2012 19:43:33 -0500
Welcome to Statalist, Ras!
You apparently believe that the order in which you enter the predictors has some consequence. That is not so. You only need a single model to assess the effect of each predictor, adjusting for the others: no looping required. To prove this to yourself, run both models and compare the coefficients.
Steve
[email protected]
On Feb 29, 2012, at 5:51 PM, Ras Dondo wrote:
Dear All,
I am new to Stata and having difficulty fitting a
model. I have one dependent variable RECOVER coded 0 or 1. I also have
10 independent categorical variables AGE, EDUCATION, RELIGION, MARITAL,
SOC_CLASS, COUNTRY_BIRTH, EMPLOYMENT, YEARS_WORKED, NO_PARTNERS, and
FAMILY_SIZE. I wish to model the effect of each sociodemographic
variable on the dependent variable RECOVER whiles controlling for the
remaining nine independent variables. First time round I wish to model
the effect of AGE on RECOVER whiles controlling for the remaining nine
variables as below.
xi: logistic RECOVER i.AGE i.EDUCATION
i.RELIGION i.MARITAL i.SOC_CLASS i.COUNTRY_BIRTH i.EMPLOYMENT
i.YEARS_WORKED i.NO_PARTNERS i.FAMILY_SIZE
Second time round I
will wish to model the effect of EDUCATION on RECOVER whiles controlling
for the remaining nine variables as below.
xi: logistic RECOVER i.EDUCATION i.RELIGION i.MARITAL i.SOC_CLASS
i.COUNTRY_BIRTH i.EMPLOYMENT i.YEARS_WORKED i.NO_PARTNERS i.FAMILY_SIZE i.AGE
My
question is instead of repeating the logistic command is it possible to
write one command maybe using looping that will let me avoid the
repetition?
Ras
*
* 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/