Dear all,
I have an estimating function as y=b1+x2*b2+x3*b3+x4*b4+u. The sample size is N. u follows a multivariate distribution with a NxN correlation matrix generated from Mata.
My strategy is to first generate an NX1 vector of u from Mata and transfer it to Stata as a variable. The other variables x2, x3, x4 are generated in Stata using the simulate command.
I tried two methods, the first one is: I use the simulate command and put the Mata commands in between the Stata commands. The second one is: I first simulate the data set of x2 x3 x4 and merge u to the simulated data set.
But it seems they could not go through, can anyone help me?
Codes for first method is in attachment.
Thank you.
I have an estimating function as y=b1+x2*b2+x3*b3+x4*b4+u. The sample size is N. u follows a multivariate distribution with a NxN correlation matrix generated from Mata.
My strategy is to first generate an NX1 vector of u from Mata and transfer it to Stata as a variable. The other variables x2, x3, x4 are generated in Stata using the simulate command.
I tried two methods, the first one is: I use the simulate command and put the Mata commands in between the Stata commands. The second one is: I first simulate the data set of x2 x3 x4 and merge u to the simulated data set.
But it seems they could not go through, can anyone help me?
Codes for first method is in attachment.
Thank you.
Comment