Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: RE: st: Regression: All possible subsets


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: RE: st: Regression: All possible subsets
Date   Sun, 26 Nov 2006 11:48:55 +0900

Raphael Fraser wrote:

tryem has no help file. I threw some variables at it and it froze.
Nick?? Are you there?

--------------------------------------------------------------------------------

Hmmm . . . -findit- doesn't bring up either -tryem- or -allpossible-.

-tryem- is an older module by Al Feiveson; -allpossible- is the one by Nick
Cox.  -tryem- does linear regression.  -allpossible- is more general.

In any event, there is a help file for -tryem- on my machine (printed out
below after the example of its use).  I'm not sure why it's not there on SSC
anymore.  The help file mentions that you'll need to have
installed -mktime-.

Joseph Coveney

. clear

. set more off

. set obs 7
obs was 0, now 7

. forvalues i = 1/7 {
 2. generate float a`i' = 0.5 + 0.5 * (`i' == _n)
 3. }

. mkmat a*, matrix(A)

. drawnorm y x1 x2 x3 x4 x5 x6, corr(A) n(25) seed(`=date("2006-11-26",
"ymd")') clear
(obs 25)

. forvalues i = 5(-1)1 {
 2. tryem y x1 x2 x3 x4 x5 x6 `i'
 3. }
n = 6
var =  y    x1    x2    x3    x4    x5    x6    5
--------------------------------------------

 1  3  4  5  6
   .300381  best of size 5
subset is x1 x3 x4 x5 x6
--------------------------------------------
n = 6
var =  y    x1    x2    x3    x4    x5    x6    4
--------------------------------------------

 1  3  4  6
   .299128  best of size 4
subset is x1 x3 x4 x6
--------------------------------------------
n = 6
var =  y    x1    x2    x3    x4    x5    x6    3
--------------------------------------------

 1  4  6
   .296403  best of size 3
subset is x1 x4 x6
--------------------------------------------
n = 6
var =  y    x1    x2    x3    x4    x5    x6    2
--------------------------------------------

 1  6
   .291414  best of size 2
subset is x1 x6
--------------------------------------------
n = 6
var =  y    x1    x2    x3    x4    x5    x6    1
--------------------------------------------

 6
   .201019  best of size 1
subset is x6
--------------------------------------------

. chelp tryem

--------------------------------------------------------------------------------------------------------

Help file for the command tryem
--------------------------------

Syntax
------

tryem var varlist k


Options
-------

Description
-----------
'TRYEM': module to run all possible subset regressions
tryem calculates all possible regressions of a given subset size.
The maximum number of subsets, k, is one fewer than the total number of
independent variables.
The module mktime is required.

tryem finds best regression subset of size k by brute force.
It assumes independent variables are x1-xn and dependent variable is y
`1' = dep;   `2',..`nv+1' are indeps `nv+2'=k



Examples
--------
Example: tryem yyy xvar1 xvar2 xvar3 xvar4 2  finds best 2-subset regression
of
yyy on 4 indep variables xvar1,xvar2,xvar3,xvar4


Author(s)
---------

Al Feiveson, Johnson Spaceflight Center
Email: [email protected]

Also see
--------


--------------------------------------------------------------------------------------------------------

.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index