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 are not equal to coefficients on standardized variables?
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Beta coefficients are not equal to coefficients on standardized variables?
Date
Sat, 16 Jun 2012 10:14:46 +0200
On Fri, Jun 15, 2012 at 5:22 PM, Roberto Liebscher wrote:
> There is one thing that makes me puzzling about the - beta - option in
> regression commands. In a simple example using the lifeexp dataset I first
> used the built-in function - beta - :
<snip>
> Then I standardized the variables by hand and re-ran the regression with the
> new variables:
<snip>
> Now the coefficients are slightly different. For example the coefficient on
> gnppc_std is 0.6608475 whereas it has been 0.6506803 in the first
> calculation.
> Is this caused by rounding errors? Or is there any other explanation for
> this?
The main reason is that you standardized within the wrong sample. The
-beta- option will standardize within the sample used by -regress-,
i.e. ignore all observations where at least one variable contained a
missing value. You standardized within the entire dataset. After that
there is still a little difference, which you can take away by
creating the standardized variables as -double-.
*---------------- begin example ------------------
sysuse lifeexp, clear
regress lexp gnppc popgrowth, beta
// standardize in the false sample
egen popgrowth_std_fs = std(popgrowth)
egen lexp_std_fs = std(lexp)
egen gnppc_std_fs = std(gnppc)
regress lexp_std_fs gnppc_std_fs popgrowth_std_fs
// get the right sample
gen byte touse = !missing(popgrowth,lexp,gnppc)
egen popgrowth_std = std(popgrowth) if touse
egen lexp_std = std(lexp) if touse
egen gnppc_std = std(gnppc) if touse
regress lexp_std gnppc_std popgrowth_std
// extra precision
egen double popgrowth_std_d = std(popgrowth) if touse
egen double lexp_std_d = std(lexp) if touse
egen double gnppc_std_d = std(gnppc) if touse
regress lexp_std_d gnppc_std_d popgrowth_std_d
*----------------------- end example --------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/