Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: svy, stepwise, and xi, with a by(variable) tacked on for good measure


From   "Costello, Michael (Contractor)" <mcostello/Contractor@rti.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: svy, stepwise, and xi, with a by(variable) tacked on for good measure
Date   Thu, 29 Jul 2010 14:31:39 -0400

Statalist,

I have a data set that looks like this:
yvar
xvar1
xvar2
xvar3
xvar4 where xvar4 is categorical with 6 levels

The data is weighted with the svy command.  I would like to do a backwards selection.


What works:
xi i.var4
stepwise, pr(.05): regress yvar xvar1 xvar2 xvar3 _Ixvar4_2 _Ixvar4_3 _Ixvar4_4 _Ixvar4_5 _Ixvar4_6 [pw=wt_final]


but when I use 
xi i.var4
by (year), stepwise, pr(.05): regress yvar xvar1 xvar2 xvar3 _Ixvar4_2 _Ixvar4_3 _Ixvar4_4 _Ixvar4_5 _Ixvar4_6 [pw=wt_final]

stata flips out, even though http://www.stata.com/help.cgi?stepwise says it should work (second line under the syntax, options box).

And is this even doing the weights?  I'm used to using the svy functions.
Lastly, is there a more succinct way of doing categorical variables?  I have several, and this process for including them is annoying.  I cannot get the xi: function to work either.  Wait, is there a limit on the number of parameters BEFORE the colon?

Thanks so much for any guidance you can give.

--
Michael Costello
Intern, Education Policy and Systems
RTI International      


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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index