Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: FW: RE: stepwise regression with force statment

From   Liping Huang <>
To   "''" <>
Subject   st: FW: RE: stepwise regression with force statment
Date   Fri, 6 Jun 2003 13:58:32 -0400

Thanks for Nick's suggestion.  Sorry I didn't state clear for what is the
reasons make me to think about using stepwise regression model but force the
model including some variables.  In fact, before running the model, I've
done all different tests and cautiously selected the variables that I'd like
to put into the model.   Although I've know some of variables are
significant in the model, however, for the purpose of showing the entire
relationship of a dependent variable with a group of length of stay
variables, such as 10 days, 20 days, and etc, to someone else, I'd like to
force these variables into to model.   That's the story.

Actually I found the code about how to doing it:

sw regress depvar (var1-var3) var4 ..., pr(.05)  lockterm1

-----Original Message-----
From: Nick Cox []
Sent: Friday, June 06, 2003 1:20 PM
Subject: st: RE: stepwise regression with force statment

Liping Huang

> Does anyone know the syntax about a stepwise regression but
> force some
> independent variables into the model? I know how to do the
> stepwise but
> couldn't find the syntax to force the model including some
> variables.

I don't think there is one in -sw-, and with very good reason.

I think you can't have it both ways. If you want your model
to be selected by whatever addition or removal criteria you specify,
you can't also say a priori that certain predictors must belong
in the model.

What you could try, I suppose, is

        1. regress response on the predictors you believe in

        2. put the residuals from that into a stepwise as
        response with all the other predictors.

but quite how you put that all together, and what status
it has, is anybody's guess.

Better advice, I think, is to seek out Frank Harrell's
"Regression modeling strategies" for a long list of reasons
why stepwise is a very bad idea.


*   For searches and help try:
*   For searches and help try:

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