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: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#
From
David Hoaglin <[email protected]>
To
[email protected]
Subject
Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#
Date
Fri, 18 Jan 2013 23:32:01 -0500
Daniel,
The definition of a coefficient in a multiple regression model
includes the list of all the other predictors in the model. Thus,
using a different predictor for sex changes the definitions of the
coefficients for patient and the categories of when.
If the other predictors were orthogonal to sex, the numerical values
of their coefficients would not differ among the models, even though
the definitions were not the same.
Your models may be equivalent, in the sense that they have the same
predicted values and the same residuals, but they are not all the same
model.
I hope this discussion helps.
David Hoaglin
On Fri, Jan 18, 2013 at 6:45 PM, <[email protected]> wrote:
> Hello,
>
> when i use indicator i with selecting level of a factor variable like i1.varname to run a regression I get strange results.
>
> For example:
>
> sysuse blong,clear
> regress bp i.sex i.when c.patient i.when#c.patient
> regress bp i1.sex i.when c.patient i.when#c.patient
> regress bp i0.sex i.when c.patient i.when#c.patient
>
> This regression is wihout sense but theoretically it should estimate the same model and should give same results except for variable sex cause all I do is demand an indicator for a different level of a 2-level variable sex.
> But if I run these lines I get three regressions with three different coefficients for the variable "when" and "patient" even I didnt change anything that should be related to these variables.
> Whats wrong here?
>
> regards
> Daniel
*
* 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/