Error term, no zero conditional mean
2 ビュー (過去 30 日間)
古いコメントを表示
Dear Matlab, I am testing the properties of the least squares estimator b under the Gauss-Markov assumptions, and I would like to see what happens if for example the error term does not have a zero conditional mean or does not follow a normal distribution. Could anyone explain me how should I recode the part of the error term? I already tried "e=rand(n,1)" but in the graph that I obtain, beta_hat looks that still follows a normal distribution.
alpha=1; beta=1; n=100; m=1000; beta_hat=zeros(m,1); for i=1:m x=randn(n,1); e=randn(n,1); y=alpha+beta*x+e; X=[ones(n,1) x]; beta_hatvec=(inv(X'*X))*X'*y; beta_hat(i)=beta_hatvec(2); end histfit(beta_hat)
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!