# st: RE: Program to drop insignificant variables from an equation

 From "Martin Weiss" To Subject st: RE: Program to drop insignificant variables from an equation Date Wed, 20 Aug 2008 14:22:23 +0200

```-h stepwise-

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of XandeR XandeR
Sent: Wednesday, August 20, 2008 12:45 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Program to drop insignificant variables from an equation

Hello.
I want to make a script that automatically one by one drops insignificant
variables from a regression, starting from the most insignificant one. I am
currently writing MSc dissertation and I am running regression with 3
variables and 312 dummies not all of which are significant. So it would be a
great help if the STATA could do it for me.
The syntax of the regression is:

reg offer timedum* mean stdev skew id*, noconst cluster(show_id)

where mean stdev and skew are independent variables and timedum* and id* are
six time dummies and 306 cross-sectional dummies. On my own I got as far as
generating a vector of t-stats (the program for that follows in the end of
this message). However I do not know what to do next with it. My critical
value for this program is 1.96 (although it would be even better to make
STATA to calculate a critical value as well).

Hope any of you guys can help me out.
Thank you very much in advance.
Regards
Alex

My script for generating a vctor of t-values:

set more off
matrix A = e(b)
matrix B = e(V)
local a = rowsof(B)
di "a is `a'
local c = ""
matrix T=J(`a',1,0)
forval i=1/`a' {
matrix T[`i',1] = el(A,1,`i')/sqrt(el(B,`i',`i'))
}

*
*   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/

*
*   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/
```