由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS simulation question (包子题 - 5个)
相关主题
SAS应用问题新手请教proc IML里do loop的问题
有个非常非常小白的SAS问题求问一个R apply 函数的问题
请教一个SAS的问题SAS help
how to get a length of a vector in SAS/IMLRe: 请问SAS如何学起?
Ask about IML in SAS[合集] 发伪币3000 - 不用SAS\IML如何用SAS做矩阵计算?
问有关sas的画图问题[合集] SAS/IML problem
问一个数据处理的R的问题请教SAS IML调用DATA step数据的问题
Ask help for R data restructure, Thanks!!! (转载)关于R的优劣,与其他软件的比较
相关话题的讨论汇总
话题: bbb话题: variance话题: mean话题: year话题: sim
进入Statistics版参与讨论
1 (共1页)
s***r
发帖数: 1121
1
Here is the original database
FirmID Year earnings Mean Variance
BBB 2004 E1 x1 std1
BBB 2005 E2 x2 std2
BBB 2006 E3 x3 std3
BBB 2007 E4 x4 std4
BBB 2008 E5 x5 std5
I want to randomly generate 50 numbers, normally distributed, with the mean/
variance as defined.
I want to create a new database like this:
FirmID Year earnings Mean Variance sim_num1 sim_num2.. sim_num50
BBB 2004
g*********e
发帖数: 458
2
我不是牛人,初学者,不知道能不能解决你的问题:我的想法是先写个小loop生成符合
规定的随机量,然后用macro来反复调用这个小loop生成许多你要的mean and var。然
后合并这些out里的mean and var。

mean/

【在 s***r 的大作中提到】
: Here is the original database
: FirmID Year earnings Mean Variance
: BBB 2004 E1 x1 std1
: BBB 2005 E2 x2 std2
: BBB 2006 E3 x3 std3
: BBB 2007 E4 x4 std4
: BBB 2008 E5 x5 std5
: I want to randomly generate 50 numbers, normally distributed, with the mean/
: variance as defined.
: I want to create a new database like this:

l*********s
发帖数: 5409
3
you want to draw a sample with defined mean and variance? that is strange.
g**a
发帖数: 2129
4
data one;
input FirmID $ Year earnings $ Mean Variance ;
datalines;
BBB 2004 E1 100 8
BBB 2005 E2 300 10
BBB 2006 E3 600 12
BBB 2007 E4 530 30
BBB 2008 E5 410 28
;
run;
proc IML;
use one;
read all;
xmean=mean;
xvar=variance;
xyear=year;
Numrow=Nrow(xmean);
do y=1 to Numrow;
sim=rand('NORMAL', mean[y], sqrt(variance[y]));
do x=2 to 250 by 1;
sim=sim||rand('NORMAL', mean[y], sqrt(variance[y]));
s***r
发帖数: 1121
5
您转给 gaea,现金(伪币):25,收取手续费:0.25
同时附加了如下留言给 gaea.
Da Niu - Many thanks for yor help!
D*A
发帖数: 811
6
大牛,学习

【在 g**a 的大作中提到】
: data one;
: input FirmID $ Year earnings $ Mean Variance ;
: datalines;
: BBB 2004 E1 100 8
: BBB 2005 E2 300 10
: BBB 2006 E3 600 12
: BBB 2007 E4 530 30
: BBB 2008 E5 410 28
: ;
: run;

h*********y
发帖数: 1080
7
Re
1 (共1页)
进入Statistics版参与讨论
相关主题
关于R的优劣,与其他软件的比较Ask about IML in SAS
[合集] 想买SAS软件,帮我看看哪个选择好?问有关sas的画图问题
SAS Question问一个数据处理的R的问题
SAS 问题求助,有包子Ask help for R data restructure, Thanks!!! (转载)
SAS应用问题新手请教proc IML里do loop的问题
有个非常非常小白的SAS问题求问一个R apply 函数的问题
请教一个SAS的问题SAS help
how to get a length of a vector in SAS/IMLRe: 请问SAS如何学起?
相关话题的讨论汇总
话题: bbb话题: variance话题: mean话题: year话题: sim