I am trying to perform a simple simulation on STATA. In particular I am constructing a vector called beta which is 1x4 and a matrix, X which is 4x11000. I would like to perform the following operation: beta*X but it is actually not allowed.
The code is the following:
Code:
clear all set obs 11000 set seed 45684123 *CASO CON DELTA_T_min: gen alpha = 0.5 gen epsilon = (0.2)^(-0.5) gen x_1 = rnormal(0.4,2) gen x_2 = rnormal(1,4) gen x_3 = rnormal(0.7,1) gen x_4 = rnormal(0.9,3) set matsize 11000 mkmat x_1 x_2 x_3 x_4, matrix(X) //training set matrix matrix beta = (0.8\0.8\0.8\0.8) matrix X_transpose = X' gen y_tilde = beta*X_transpose+epsilon
Code:
matrix operators that return matrices not allowed in this context
0 Response to Matrix operations
Post a Comment