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]

From |
Richard Williams <richardwilliams.ndu@gmail.com> |

To |
statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i# |

Date |
Sat, 19 Jan 2013 01:57:23 -0500 |

At 01:12 AM 1/19/2013, Sarah Elizabeth Edgington wrote:

I share Daniel's confusion and this explanation doesn't make it anyclearer to me.If sex were not a binary variable then the other coefficientschanging would make sense because the different regressions wouldactually be changing how sex is coded. However, with a variablethat's coded 0/1 to begin with, isn't i.sex the equivalent ofi1.sex? That is, isn't an indicator for when sex=1 exactly the samevariable as the original sex variable? In which case you'd expectthe first two regression examples to be exactly the same. The factthat they aren't suggests to me that there's something I don'tunderstand about the i1.sex factor variable syntax. What am I missing?-Sarah At 08:32 PM 1/18/2013, you wrote: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, <daniel56061-stata@yahoo.de> wrote: > Hello, >> when i use indicator i with selecting level of a factor variablelike 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 shouldestimate the same model and should give same results except forvariable sex cause all I do is demand an indicator for a differentlevel of a 2-level variable sex.> But if I run these lines I get three regressions with threedifferent coefficients for the variable "when" and "patient" evenI 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/* * 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/

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

**References**:**st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#***From:*daniel56061-stata@yahoo.de

**Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#***From:*David Hoaglin <dchoaglin@gmail.com>

**Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#***From:*Sarah Elizabeth Edgington <sedging@ucla.edu>

- Prev by Date:
**Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#** - Next by Date:
**st: Nonlinear regression syntax** - Previous by thread:
**Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#** - Next by thread:
**Re: st: Strange Behaviour When Selecting Levels For Factor Variables In Regression With i#** - Index(es):