Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: tuples, stepwise and counting types of variables

From   Thomas Sohnesen <>
Subject   st: tuples, stepwise and counting types of variables
Date   Mon, 13 Aug 2012 17:18:49 -0400

Dear Statlist i would be greatful if someone could help with the
following problem:

I have a number of "groups" of variables as examplified below.

local gr1  x1 x2 x3 x4

local gr2  x5 x6 x7 x8

local gr3  x9 x10 x11 x12 x13 x14 x15

local gr4    x16 x17

I run stepwise regressions for all the combinations of these groups
using tuples.

tuples "`gr1'" "`gr2'" "`gr3'" "`gr4'" , display

		forval i = 1/`ntuples' {

 qui stepwise, pr(0.05):  regress y `tuple`i''


Now i would like to count how many variables from each group that
stayed in the step wise model.

For instance in the stepwise regression of gr1 and gr2  (ei x1 x2 x3
x4   x5 x6 x7 x8) only x3 x4   x5 was included in the regression.  I
would then like an output along the lines of:

Model     Num_var_gr1     num_var_gr2  num_var_gr3  num_var_gr4

gr2 gr3        1                           2                     0

gr2 gr4

gr1 gr2

any advise greatly appriciated, thanks

Thomas Sohnesen
*   For searches and help try:

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