grouped data: generating a random error with zero group mean
3 ビュー (過去 30 日間)
古いコメントを表示
I have a variable 'group' with 20 distinct values randomly assigned for 8000 observations. I need to generate a random error term,u, with zero mean in each group, and a specific covariance, say 10. how to do that?
I can do for an overall zero mean, as
u = random('Normal',0,10,length(group),1)
but not for zero group means.
0 件のコメント
採用された回答
Tom Lane
2012 年 4 月 22 日
Your code generates each observation from a theoretical distribution that has zero mean. Consequently the theoretical mean is zero overall, and within each group. Can you describe more specifically what you need beyond this?
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Random Number Generation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!