Error term, no zero conditional mean

3 views (last 30 days)
M Fernandes
M Fernandes on 29 Sep 2017
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)

Answers (0)

Categories

Find more on Random Number Generation 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!