| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
stepwise like SPSS? [was: RE: st: Means test]
Here is a not too painful way to get more stepwise information from
Stata. Basically, just run the regressions twice: Once with
stepwise, and then again with nestreg. With nestreg, specify the
vars in the same order that stepwise added them. Example:
. use "http://www.indiana.edu/~jslsoc/stata/spex_data/ordwarm2.dta"
(77 & 89 General Social Survey)
. sw, pe(.05): reg warm yr89 male white age ed prst
begin with empty model
p = 0.0000 < 0.0500 adding age
p = 0.0000 < 0.0500 adding male
p = 0.0000 < 0.0500 adding yr89
p = 0.0000 < 0.0500 adding ed
p = 0.0022 < 0.0500 adding white
[Output deleted]
. nestreg, quietly: reg warm age male yr89 ed white
Block 1: age
Block 2: male
Block 3: yr89
Block 4: ed
Block 5: white
+-------------------------------------------------------------+
| | Block Residual Change |
| Block | F df df Pr > F R2 in R2 |
|-------+-----------------------------------------------------|
| 1 | 103.49 1 2291 0.0000 0.0432 |
| 2 | 83.64 1 2290 0.0000 0.0769 0.0337 |
| 3 | 67.28 1 2289 0.0000 0.1033 0.0264 |
| 4 | 35.46 1 2288 0.0000 0.1170 0.0137 |
| 5 | 9.44 1 2287 0.0022 0.1206 0.0036 |
+-------------------------------------------------------------+
You may want to use some of the other nestreg options too, e.g. you
can ask for likelihood ratio tests rather than Wald and you can have
it store the results of each model. And if you want more of the blow
by blow details, you can leave off the quietly option. A nice thing
about the -lr- option is that it also gives you AIC and BIC
statistics for each model:
. nestreg, quietly lr: reg warm age male yr89 ed white
Block 1: age
Block 2: male
Block 3: yr89
Block 4: ed
Block 5: white
+----------------------------------------------------------------+
| Block | LL LR df Pr > LR AIC BIC |
|-------+--------------------------------------------------------|
| 1 | -3031.664 101.31 1 0.0000 6067.329 6078.804 |
| 2 | -2990.536 82.26 1 0.0000 5987.073 6004.286 |
| 3 | -2957.325 66.42 1 0.0000 5922.65 5945.6 |
| 4 | -2939.694 35.26 1 0.0000 5889.388 5918.076 |
| 5 | -2934.973 9.44 1 0.0021 5881.945 5916.371 |
+----------------------------------------------------------------+
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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/