grouped data: generating a random error with zero group mean
조회 수: 1 (최근 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!