rogerfoxzhang 发表于 2010-6-27 16:24
各位大侠,请教:
原来有一组数据,比如
A
129
130
131
134
正常用means计算标准差,比如是1;
有一个加权的变量,对应如
A B
129 5
130 15
131 16
134 7
用means加上weight做SD,结果变大了,比如为3;
理论上,应该数据越多SD应该相对变小,为什么SD反而变大了三倍了。是不是算错了,有什么其他的方法可以计算这种加权后的标准差吗,理想的SD加权后应该不变或变小一点啊。谢谢!
"理论上,应该数据越多SD应该相对变小,为什么SD反而变大了三倍了". ---Put the weighting aside, this is talking about the variance of
mean estimator, NOT about the variance of the random variable. Your understanding is wrong.
data t1;
do i =1 to 100;
x=normal(123);
g=1;
output;
end;
do i =1 to 10000;
x=normal(123);
g=2;
output;
end;
run;
proc means data=t1;
class g;
var x;
run;
The MEANS Procedure
Analysis Variable : x
g N Obs N Mean Std Dev
------------------------------------------------------------------
1 100 100 -0.0930159 0.9626726
2 10000 10000 -0.0211541 1.0004539
------------------------------------------------------------------