Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: dummy trapped but not sure why


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: dummy trapped but not sure why
Date   Wed, 23 May 2007 22:41:09 +0100

An orthogonal note is that you can cut down on 
typing by using -inlist()-, e.g. 

gen someplacedownsouth = inlist(state, "GA", "NC", "TN") 

There are limits on the number of values, but 
this is still useful. 

Nick 
[email protected] 

Austin Nichols
 
> Brady--
> The source of the collinearity will be more clear if you generate your
> variable  intest2 in one line using the dummies, I think:
> 
> g intest2 = 100*STOH+100*STVA+100*STWV
> +50*STAL+50*STKY+50*STMD+50*STNY+50*STPA+50*STSC
> +33*STGA+33*STNC+33*STTN+25*STMS
> 
> On 5/23/07, [email protected] <[email protected]> wrote:
> >
> > gen STAL = (state == "AL")
> > gen STGA = (state == "GA")
> > gen STKY = (state == "KY")
> > gen STMD = (state == "MD")
> > gen STMS = (state == "MISS")
> > gen STNC = (state == "NC")
> > gen STOH = (state == "OH")
> > gen STPA = (state == "PA")
> > gen STTN = (state == "TN")
> > gen STVA = (state == "VA")
> > gen STWV = (state == "WV")
> > gen STNY = (state == "NY")
> > gen STSC = (state == "SC")
> >
> > gen intest2 = 100 if state == "OH" | state == "VA" | state == "WV"
> > replace intest2 = 50 if state == "AL"| state == "KY" | 
> state == "MD" |
> > state == "NY"|  state == "PA" | state == "SC"
> > replace intest2 = 33 if state == "GA" | state == "NC" | 
> state == "TN"
> > replace intest2 = 25 if state == "MISS"
> >
> > regress Y intest2 STAL STGA STKY STMD STNC STOH STPA STTN 
> STVA STNY STSC STWV
> >
> > <<<this regression exhibits perfect collinearity but I'm 
> not sure why>>>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index