您好,我需要Stata的Mata编程语言帮助以获得以下最小工作示例。Stata Mata编程一致性错误
我试图在维600x1(V矩阵)的指针矩阵内插入维(1x200)(由随机正常绘制生成)的子矩阵。
mata:
T=600 //number of markets
K_S=1 //number of variables with stochastic coefficients
R=200 //number of random draws
st_matrix("T", T)
//pointers to the market specific random draws:
V=J(T,1,NULL) // T by 1 0 matrix
for(t=1;t<=T;t++){
V[t]=(rnormal(K_S,R,0,1)) //dimension K_S x R
}
end
的问题是,我得到一个“rnormal():3200一致性错误”
莫非你有什么建议,我做错了。
感谢
在你的情况下,我无法越过'st_matrix(“T”,600)',这会在Stata(NB)中创建一个1×1的矩阵并保存常量600.这是什么意思?这对我来说看起来像XY问题。你需要一个600 x 200的矩阵吗?如果是这样,为什么不直接生产呢?为什么需要指针? http://xyproblem.info/ –