Error term, no zero conditional mean
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!