Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Program to drop insignificant variables from an equation


From   David Airey <david.airey@Vanderbilt.Edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Program to drop insignificant variables from an equation
Date   Wed, 20 Aug 2008 08:12:20 -0500

Why not stepwise regression?

Sent from my iPhone

On Aug 19, 2008, at 5:44 PM, XandeR XandeR <xanderx@mail.ru> wrote:

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/



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