Generate random errors for data with specific covariance matrices

4 次查看(过去 30 天)
Mary Tavoosi
Mary Tavoosi2021-10-3
评论: Mary Tavoosi ,2021-10-3
I have simulated 450 data for a linear regression model with 5 independent variables and a dependent variable (y=a*x1+b*x2+c*x3+d*x4+e*x5+f). Each of these data has specific weights(Wy, Wx1, Wx2, Wx3, Wx4, Wx5) . Now I want to add a random error with a mean of zero and variance (for example Sigma*inv(W) ) of each variables to this data. How can this be done?

回答(1 个)

the cyclist
the cyclist 2021-10-3
If you have the Statistics and Machine Learning Toolbox, you can generate correlated normal variables with the mvnrnd function.
  3 个评论


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by