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
José Luis Chávez Calva <[email protected]>
To
[email protected]
Subject
Re: st: RE: Regressions with combinatorial of variables
Date
Tue, 1 Feb 2011 17:37:06 -0600
Thanks Keith, I'm going to implement it to see if it works for my model.
Best regards.
JL
2011/2/1 Keith Dear <[email protected]>:
> José,
> 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'
> }
>
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of José Luis Chávez Calva
> Sent: Wednesday, 2 February 2011 6:03 AM
> To: [email protected]
> Subject: st: Regressions with combinatorial of variables
>
> Hi,
>
> I have to run different regressions with combinations of variables (I
> have 131 vars), the problem is the following
>
> I have to run:
> reg var1
> case 1) var1 is significant, then
> reg var1 var2
> case 2) car1 is not significant, then
> reg var2
> In both cases, if var2 is significant, then
> case 1) reg var1 var2 var3
> case 2) reg var2 var3
> In both cases, if var2 is not significant, then
> case 1) reg var1 var3
> case 2) reg var3
> ....
> And so on, in fact it is a kind of tree, I have tried different
> especifications (forvalues, locals, if,etc.) but I didn´t have
> results, I'm wondering if some of you have worked with something like
> this.
>
>
> Thanks
>
>
> best regards
>
>
>
> José Luis
>
> p.s. It is for obtain a smoother of the serie.
>
> *
> * 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/
>
>
> *
> * 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/
>
*
* 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/