On Thu, 6 Oct 2011, Sven Schreiber wrote: > Am 06.10.2011 09:45, schrieb Nikos Tsitiridis: >> Goodmorning, >> >> I ran 120 regressions with a script and now I want to re-run them but >> only with the variables that were found to be *statistically important >> and positive*. Do you know of any scripting methods to do this >> automatically so that I won't have to edit 120 regressions by hand? >> Thank you for your time! >> > > Check out the > 'omit --auto' > command.
That command will trim the list of regressors to leave only "significant" terms, but it will not restrict the list to variables with positive coefficients. Here's a simple example script that could serve as a basis for doing what Nikos wants: <hansl> open data4-10 list bigX = 2 3 4 5 6 7 8 9 ols 1 0 bigX matrix b = $coeff matrix s = $stderr scalar p = $ncoeff list trimmedX = null scalar j = 2 loop foreach i bigX --quiet if b[j]/s[j] > 2.0 # your criterion here trimmedX = trimmedX $i endif j++ endloop list trimmedX print ols 1 0 trimmedX </hansl> Another possibility is to look at the code of the "addlist" function package, which could be modified to suit. To do that, go to "/File/Function files/On server..." and install the addlist package. Then "/File/Function files/On local machine", select addlist, right-click, and choose "View code". Allin Cottrell