Statalist


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

RE: st: which variables are in the model?


From   "Feiveson, Alan H. (JSC-SK311)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: which variables are in the model?
Date   Thu, 5 Feb 2009 14:55:49 -0600

Austin -  Thanks for the program - I think it does what I want, except that I don't know how to modify it for multi-equation models - I am using -xtintreg-. The reason I want to do my own resampling is so I can store the results of various postestimation tests as well as the coefficient estimates - I don't think this can be done with -bsample- or can it??

But here's some interesting related information:

1. Some estimation commands (such as -reg) put a zero in e(b) and in the corresponding row/col of e(V) for dropped variables:

. use tempxy,replace

. list 
    +---------------------------------------------------+
     |       x1         x3   x2   ord   jsub           y |
     |---------------------------------------------------|
  1. | .6626155   .1144872    1     1      1    3.151041 |
  2. | .9553422   .0319636    1     2      1    3.634814 |
  3. | .0448858   .2033171    1     3      1    1.745203 |
  4. | .0059469   .3264349    1     4      1    2.375462 |
  5. | .8823879    .028055    1     5      1    2.930055 |
     |---------------------------------------------------|
  6. | .1215118   .3980549    1     6      2    3.520828 |
  7. | .2109612   .4117808    1     7      2    3.001019 |
  8. | .2764275   .8295287    1     8      2    4.037796 |
  9. | .9945256   .1112339    1     9      2    2.531682 |
 10. | .0247447   .2123476   -1    10      2   -.3951531 |
     |---------------------------------------------------|
 11. |  .438004   .6404216    1    11      3     5.10464 |
 12. | .4283594   .5567459    1    12      3    4.025568 |
 13. | .5472953   .2685844    1    13      3    4.074149 |
 14. | .8322787   .2767156    1    14      3    3.607821 |
 15. | .8315817   .9052416    1    15      3    5.359124 |
     |---------------------------------------------------|
 16. | .8530225   .2686222    1    16      4    3.704969 |
 17. |  .825601   .1173112    1    17      4    3.132042 |
 18. | .4625225   .2903162    1    18      4    3.111456 |
 19. | .3189178   .1972554    1    19      4    1.906721 |
 20. | .8438753   .2923035    1    20      4    3.028733 |
     |---------------------------------------------------|
 21. |   .25784    .163985    1    21      5     2.70085 |
 22. | .5548028   .9409158    1    22      5    4.877477 |
 23. | .0189341   .7003843    1    23      5    3.927349 |
 24. | .0900813   .1553994    1    24      5    2.552598 |
 25. | .4626715   .5168369    1    25      5    4.088204 |
     +---------------------------------------------------+

. set seed 2

. bsample

. reg y x1 x2 x3

      Source |       SS       df       MS              Number of obs =      25
-------------+------------------------------           F(  2,    22) =   19.87
       Model |  9.32793315     2  4.66396657           Prob > F      =  0.0000
    Residual |  5.16267802    22  .234667183           R-squared     =  0.6437
-------------+------------------------------           Adj R-squared =  0.6113
       Total |  14.4906112    24  .603775465           Root MSE      =  .48442

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          x1 |   1.314839    .316374     4.16   0.000     .6587192    1.970958
          x2 |  (dropped)
          x3 |   2.850627   .4876063     5.85   0.000     1.839394    3.861861
       _cons |    1.73119   .2763216     6.27   0.000     1.158135    2.304246
------------------------------------------------------------------------------

. matrix b=e(b)

. matrix list b

b[1,4]
           x1         x2         x3      _cons
y1  1.3148389          0  2.8506274  1.7311904

. matrix  V=e(V)

. matrix list V

symmetric V[4,4]
               x1          x2          x3       _cons
   x1   .10009254
   x2           0           0
   x3   .05086045           0   .23775989
_cons   -.0677765           0  -.10126528   .07635362



2. Other commands, such as -xtreg- omit the dropped variable altogether:


. xtreg y x1 x2 x3,i(jsub)
note: x2 dropped because of collinearity

Random-effects GLS regression                   Number of obs      =        25
Group variable: jsub                            Number of groups   =         5

R-sq:  within  = 0.6225                         Obs per group: min =         3
       between = 0.6109                                        avg =       5.0
       overall = 0.6429                                        max =         8

Random effects u_i ~ Gaussian                   Wald chi2(2)       =     35.75
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          x1 |   1.297074   .3251487     3.99   0.000     .6597945    1.934354
          x3 |   2.970533   .5182017     5.73   0.000     1.954876     3.98619
       _cons |   1.660674   .3234097     5.13   0.000     1.026802    2.294545
-------------+----------------------------------------------------------------
     sigma_u |  .35867633
     sigma_e |  .43705473
         rho |  .40244784   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. matrix b=e(b)

. matrix list b

b[1,3]
           x1         x3      _cons
y1  1.2970743  2.9705331  1.6606738

. matrix  V=e(V)

. matrix list V

symmetric V[3,3]
               x1          x3       _cons
   x1   .10572169
   x3   .07207609   .26853298
_cons  -.07469714  -.11799669   .10459381


3. -bootstrap- will replace the b-s with either zero or missing in the correct places, depending on the estimation command:
. set seed 1

. use tempxy,clear

. bootstrap _b _se,reps(10) saving(temp,replace): reg y x1 x2 x3
(running regress on estimation sample)

[output omitted]

. use temp
(bootstrap: regress)

. list

     +---------------------------------------------------------------------------------------+
     |    _b_x1      _b_x2      _b_x3    _b_cons     _se_x1     _se_x2     _se_x3   _se_cons |
     |---------------------------------------------------------------------------------------|
  1. |  1.13412   1.470973   2.631516   .4889599   .2358656   .1565407   .1714275   .1662199 |
  2. | 1.100519          0   2.650493   1.947971   .3659971          0   .4398493   .3249288 |
  3. | 1.364231          0   2.624209   1.754179   .2826795          0   .3054233   .2080303 |
  4. | 1.285978   1.222668   3.640214   .0227035    .302239   .2025359   .3768025   .2385865 |
  5. | 1.485684    1.33937   2.933218   .2845925   .3398912   .2594654   .3231137   .2800002 |
     |---------------------------------------------------------------------------------------|
  6. | .5283381          0   2.670116   2.295536   .4422649          0   .4391958   .3499087 |
  7. | 1.347596          0   2.535224   1.790228   .3172289          0    .410283   .2234403 |
  8. | .6168122          0   3.507943   1.717851   .2707498          0   .3651236   .2438983 |
  9. | 1.408072   1.300479   3.158506   .1997824   .3280223   .2949357   .3938662    .324038 |
 10. | 1.118752   1.454276   2.718001   .4542784   .3000017   .2176973   .2950346   .2380216 |
     +---------------------------------------------------------------------------------------+

. set seed 1

. use tempxy,clear

. bootstrap _b _se,reps(10) saving(temp,replace): xtreg y x1 x2 x3,i(jsub)
(running xtreg on estimation sample)

[output omitted]
. use temp
(bootstrap: xtreg)

. list

     +---------------------------------------------------------------------------------------+
     |    _b_x1      _b_x2      _b_x3    _b_cons     _se_x1     _se_x2     _se_x3   _se_cons |
     |---------------------------------------------------------------------------------------|
  1. |  1.13412   1.470973   2.631516   .4889599   .2358656   .1565407   .1714275   .1662199 |
  2. | 1.100519          .   2.650493   1.947971   .3659971          .   .4398493   .3249288 |
  3. | 1.358355          .   2.558118   1.786434   .2840586          .   .3110124   .2124224 |
  4. | 1.285978   1.222668   3.640214   .0227035    .302239   .2025359   .3768025   .2385865 |
  5. | 1.494756   1.318489   2.683021   .3720039    .323136   .2589509   .3763045   .2972685 |
     |---------------------------------------------------------------------------------------|
  6. |  .432989          .   2.613339    2.35052   .3316861          .   .3222143   .3054636 |
  7. | 1.516499          .   2.255655   1.816683   .3260674          .   .4912441   .2706356 |
  8. | .6168122          .   3.507943   1.717851   .2707498          .   .3651236   .2438983 |
  9. | 1.460641   1.150193   2.459682   .6032664   .2766109   .2542073   .3791084   .3345588 |
 10. |  1.17154   1.403425    2.45474   .6109908   .3282752   .2051965   .3296678   .2692362 |
     +---------------------------------------------------------------------------------------+



. 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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