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: Categorical variable in regression
From
Petya Alexandrova <[email protected]>
To
[email protected]
Subject
Re: st: Categorical variable in regression
Date
Wed, 23 Jan 2013 14:52:35 +0200 (EET)
I see. I am not sure if this works but you can try. Run the model
without 'xi'. First create dummy variables out of your categorical
variable.
tabulate region, gen(reg)
reg y reg*, noconst OR reg y reg1 reg2 reg3 reg4, noconst
Btw, i saw the command with noomit somwehere written in the following
way: xi, noomit: reg ... So, try typing your command like this:
xi, noomit: reg y i.region, noconst
I hope at least one of the options works!
Petya
>-------- Оригинално писмо --------
>От: John Ataguba [email protected]
>Относно: Re: st: Categorical variable in regression
>До: "[email protected]" <[email protected]>
>Изпратено на: Сряда, 2013, Януари 23 14:00:39 EET
> Thanks Petua for your response. Maybe my question was not clear enough. Note that I have suppressed the constant term in my regression - xi: reg y i.region, noconst noomit -. In that case there is no problem of the dummy trap. Based on Stata's documentation, the regression model I have specified is expected to run. Unfortunately, it is not running for me.
>
> I look forward to more response.
>
> Regards
>
> Jon
>
>
> >________________________________
> > From: Petya Alexandrova
> >To: [email protected]
> >Sent: Wednesday, 23 January 2013, 13:32
> >Subject: Re: st: Categorical variable in regression
> >
> >In a regression with dummy variables one category is always omitted because it is the reference category.
> >You can modify which category to be used as a reference group.
> >
> >Petya
> >
> >
> >
> >
> >
> >>-------- Оригинално писмо --------
> >
> >>От: John Ataguba [email protected]
> >
> >>Относно: st: Categorical variable in regression
> >
> >>До: Statalist statalist mailing
> >
> >>Изпратено на: Сряда, 2013, Януари 23 13:22:09 EET
> >
> >
> >
> >
> >> Dear Statalist members
> >
> >> I have a problem trying to let Stata display coefficients for all the categories of a categorical variable in a regression.
> >
> >> Consider the example below:
> >
> >>
> >
> >> **********************************************
> >
> >> clear
> >
> >> set obs 200
> >
> >> set seed 12345
> >
> >> gen region = 1+int((4-1+1)*runiform())
> >
> >> gen y = 10+(56-10)*runiform()
> >
> >> xi: reg y i.region, noconst noomit
> >
> >> **********************************************
> >
> >>
> >
> >> I expect Stata to display the coefficients for all the four categories of the categorical variable named "region". However, Stata still omits one category. Is there something I am doing wrong?
> >
> >>
> >
> >> I am running Stata 12.1 (SE) on Windows 7 platform. I also tried this in Stata 11.2 (IC) on Windows 7 platform and I obtained the same result.
> >
> >>
> >
> >> I will appreciate your assistance.
> >
> >>
> >
> >> Regards
> >
> >>
> >
> >> Jon
> >
> >>
> >
> >> *
> >
> >> * 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/
> >
> >
> >
>
> *
> * 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/