Statalist


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

st: Generating grouped variable list of xi'd variables via column names


From   "K Jensen" <[email protected]>
To   [email protected]
Subject   st: Generating grouped variable list of xi'd variables via column names
Date   Fri, 13 Jul 2007 12:00:05 +0100

Hi everyone
I would like to generate lists of groups of variables that have been
generated via xi from the column names of the vector e(b) after
regression commands.
It's probably easier to explain with an example...

  sysuse cancer
  stset studytime, fail(died)
  gen randcat=1
  replace randcat=2 if uniform()>1/3
  replace randcat=3 if uniform()>2/3
  xi:stcox i.drug age i.randcat

  . matrix list e(b)

  e(b)[1,5]
         _Idrug_2     _Idrug_3          age  _Irandcat_2  _Irandcat_3
  y1   -1.7300519   -3.2313217    .12791436   -.93457115   -.77850524

I would like to take the column names from e(b) to generate a varlist
of the xi-generated variable groups, something like:
_Idrug* _Irand*

...so that I can loop through these and run testparm on each group:
  . testparm _Idrug*

   ( 1)  _Idrug_2 = 0
   ( 2)  _Idrug_3 = 0

             chi2(  2) =   25.98
           Prob > chi2 =    0.0000

  . testparm _Irand*

   ( 1)  _Irandcat_2 = 0
   ( 2)  _Irandcat_3 = 0

             chi2(  2) =    3.57
           Prob > chi2 =    0.1678

I am using stepwise procedures++ with xi-generated variables entered
as a group e,g,
stcox (_Idrug*) age, so I don't know in advance which variables will
be included in a model.

Thankyou in advance
Karin

++I am aware of the problems associated with stepwise regressions, but
I am trying to get an exploratory grip on a large dataset!
*
*   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