Code:
clear set obs 100 local nsimulations 100 local N = _N mata hdrawsburn = J(`N'+10,100,.) hdraws = J(`N',100,.) p = (3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547) for (i=1; i<=100; i++) { hdrawsburn[,i] = ghalton(`N'+10,p[1,i],0) } for (i=1; i<=`N'; i++) { hdraws[i,] = hdrawsburn[i+10,] } hdraws = hdraws' end getmata (f1_*)=hdraws
Code:
clear set obs 100 local nsimulations 100 local N = _N forval i = 1/`nsimulations'{ gen double f1_`i' = . } mata hdrawsburn = J(`N'+10,100,.) hdraws = J(`N',100,.) p = (3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547) for (i=1; i<=100; i++) { hdrawsburn[,i] = ghalton(`N'+10,p[1,i],0) } for (i=1; i<=`N'; i++) { hdraws[i,] = hdrawsburn[i+10,] } hdraws = hdraws' st_store(.,"f1_1",hdraws[,1]) end
Code:
for (i=1; i<=`N'; i++) { st_store(.,"f1_i",hdraws[,i]) }
0 Response to Mata matrix to variables using st_store
Post a Comment