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: RE: Regressions with combinatorial of variables
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: RE: Regressions with combinatorial of variables
Date
Wed, 2 Feb 2011 00:57:30 +0000
The procedure here assumes that you know that it makes best sense to
try the variables in precisely that order, and only that order.
Perhaps you know that, but either way that would be a very special
problem.
Nick
2011/2/1 José Luis Chávez Calva <[email protected]>:
> Thanks Keith, I'm going to implement it to see if it works for my model.
> 2011/2/1 Keith Dear <[email protected]>:
>> I think this does what you want:
>>
>>
>> * set up some data with weak relationships
>> glo N 131 // number of x-variables
>> set obs 256
>> forval i=1/$N {
>> gen var`i'=runiform()
>> }
>> egen Y = rsum(var*) // outcome variable
>> replace Y = 0.2*Y + rnormal(0,1)
>>
>> * now the work. $X holds a growing list of significant vars
>> glo X
>> forval i=1/$N {
>> di "`i': $X"
>> qui reg Y $X var`i'
>> qui test var`i'
>> if r(p)<.05 glo X $X var`i'
>> }
*
* 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/