It follows a code that I have developed during some other works. It generates !size series randomly distributed according to a multivariate normal with the covariance matrix also generated randomly. This may be changed to generate according to the desired covariance matrix. Just make sure that the cov. matrix is positive semi-definite.
It might be useful for some...
Code: Select all
'' I was having some trouble with the near singular matrix problem. This while was my best solution for now...
while @issingular(@implode(rnd_covs))=1 ''
subroutine local rnd_pos_def_mat(matrix mat_res)
for !i=1 to !size
for !j=!i+1 to !size
subroutine rnd_multivariate_normal(matrix covs)
for !i=1 to @columns(covs)
delete z_norm vz_norm
delete covs_sym cholesky vz_mat mat_xs