If you use R, then it is quite easy. Like
x<-matrix(nrow=30, ncol=10, byrow=FALSE)#define the structure to store the data
for (i in 1:10){x[,i]=rchisq(30, 1,1)}#x from Chisquare (1)
x#is what you wanted
If you use sas, then PROC IML works as below:
PROC IML;
call randseed(1234);
x=j(30, 10);*30 row, 10 columns;
call randgen (x, "CHISQ", 5 );**Chi-squre with freedom as 5, center parameter as 0;
print x;
quit;
suzhzh 发表于 2016-7-6 18:14
If you use R, then it is quite easy. Like
x
谢谢你的回复,看了之后我有如下问题:
(1)程序for (i in 1:30){x[,1]=rchisq(30, 1,1)}中for (i in 1:30)对于x好像没有起到循环作用
(2)这样生成的数据能满足两两独立吗?你的意思是对{x[,1]=rchisq(30, 1,1)}循环10次是吗?这样能得到这10次的数据是独立的吗?
谢谢你的回复,问题如下
(1)for (i in 1:30){x[,1]=rchisq(30, 1,1)}是否应该改为for (i in 1:10){x[,i]=rchisq(30, 1,1)},这样就会生成10列数据,每列数据容量为30
(2)为什么这样能保证两两独立?我不是很理解,能否给予详细的解释,谢谢。
For the 1) question, the answer is Yes.
for the 2) question, I have no list to recommend, but I would like you to google and you may get something. Many thanks.