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

st: Simulating stepwise regression

From   John Antonakis <>
Subject   st: Simulating stepwise regression
Date   Fri, 07 Aug 2009 11:47:16 +0200


I would like to simulate the below. Note, I am no fan of stepwise--I just want to demonstrate it evils

However, I do not know

1. what to put in the place of "??"--that is, I want the program to capture only the variables that were selected in the model as being significant

2. how to simulate the r-square.

3. how to extend the simulation (a new program) such that I simulate from n = 50 to n=1000 (in increments of 50), crossed with independent variables ranging from x1 to x100.


Here is the program:

set seed 123456

capture program drop sim
version 10.1
program define sim, eclass
       drop _all

set obs 100

gen y = invnorm(uniform())
gen x1 = invnorm(uniform())
gen x2 = invnorm(uniform())
gen x3 = invnorm(uniform())
gen x4 = invnorm(uniform())
gen x5 = invnorm(uniform())

stepwise, pr(.2): regress y x1-x5

simulate ??? , reps(20) seed (123) : sim,

foreach v in ?? {
gen t_`v' = /*
gen p_`v' =/*
*/ 2*(1-normal(abs(t_`v')))


Prof. John Antonakis
Associate Dean Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny

Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

Faculty page:

Personal page:

*   For searches and help try:

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