使用center中心化/标准化变量
(2014-04-22 20:14:06)
标签:
center中心化标准化财经 |
分类: 神器stata |
中心化:center x
Variable |
Obs
Mean Std.
Dev. Min
Max
x2 |
8438
55.11448
15.1841
16
111
c_x2 |
8438 -7.75e-07
15.1841
-39.11448 55.88552
Variable |
Obs
Mean Std.
Dev. Min
Max
x2 |
8438
55.11448
15.1841
16
111
c_x2 |
8438 -7.75e-07
15.1841
-39.11448 55.88552
x21 |
8438
-7.75e-07 15.1841
-39.11448 55.88552
storage display
value
Variable |
Obs
Mean Std.
Dev. Min
Max
x3 |
8438
55.11448
15.1841
16
111
c_x3 |
8438 -5.03e-08
1 -2.576017
3.68053
x31 |
8438
-5.03e-08
1 -2.576017
3.68053
x32 |
8438
-7.75e-07 15.1841
-39.11448 55.88552
x33 |
8438
-2.24e-09
1 -2.576017
3.68053
标准化:center x,standardize
1、生成交互项是只需要中心化,并不需要标准化,使用center命令。
center是外部命令,先安装一下
ssc install center
. center x2 // 生成的新变量,其名字自动加前缀 c_
. sum x2 c_x2
-------------+--------------------------------------------------------
如果不想使用自动名称,也可以
. center x2,gen(x21)
. sum x2 c_x2 x21
-------------+--------------------------------------------------------
2、利用center标准化
. center x3,standardize
. center x3,standardize gen(x31)
. center x3, gen(x32)
. egen x33=std(x3)
. des x3 c_x3 x31 x32 x33
variable name type
format
label
variable label
----------------------------------------------------------------------------------------------------------------------------
x3
float %9.0g
c_x3
float
%9.0g
x3 (standardized)
x31
float
%9.0g
x3 (standardized)
x32
float
%9.0g
x3 (centered)
x33
float
%9.0g
Standardized values of (x3)
. sum x3 c_x3 x31 x32 x33
-------------+--------------------------------------------------------
.