Bookmark and Share

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]

st: Dropping variables in regression equations based on R-Squared value


From   George Murray <[email protected]>
To   [email protected]
Subject   st: Dropping variables in regression equations based on R-Squared value
Date   Sat, 20 Jul 2013 16:45:52 +1000

abcde
Dear Statalist,

I am running numerous regressions in the following form:

foreach x of varlist   var1-var5000{
quietly reg `x'  var5001
display "`x'" `e(r2)'
quietly reg `x'  var5002
display "`x'" `e(r2)'
}

Where e(r2) displays the R-Squared of each regression.

If *either* of the above regression equations have an R-Squared
greater than 0.95, I want to drop the variable `x' . For example, if I
regress var500 on var1001, and then on var1002, and *either* of the
regressions have an R-Squared value over 0.95, I wish to delete
var500.

Does anyone have a way of doing this? I’m doing this manually at the
moment, but is taking far too much time, and of course, it would be
better if I could find a way to do this with the code.

Thank you.

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index