Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Beta coefficients
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: Beta coefficients
Date
Fri, 14 Dec 2012 17:02:30 +0100
Also note, that with -center- (Jann, SSC) there already exists a
user-written command to center (and standardize) variables.
As minor comments on the suggested code, -egen- seems to be very slow
and not needed for this purpose. Use -summarize-to get at the means
and sds of your variables instead. Also. -perserve- and -restore-
slow down execution time. Create a standardized version of the
original variables instead of overwriting them.
Best
Daniel
--
With do it yourself approaches keep in mind that the sample used in
the estimation command may be different than the full sample (e.g.
because of missing data or because you only analyze a subset of the
data). You may therefore need to add an if qualifier of some sort,
e.g.
gen touse = !missing(y, x1, x2, x3, x4)
egen `x'_mu = mean(`x') if touse
At 10:24 AM 12/14/2012, Sjoerd van Bekkum wrote:
Hello Bülent,
You can alway standardize your coefficients yourself, for instance:
preserve
loc var " yvar xvar1 xvar2 xvar3 xvar4"
foreach x in `var' {
egen `x'_mu = mean(`x')
egen `x'_sd = sd(`x')
replace `x' = (`x'-`x'_mu)/`x'_sd
drop `x'_mu `x'_sd
}
xtivreg2 y x1 x2 x3 x4 etc etc
restore
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/