Error term, no zero conditional mean

3 visualizzazioni (ultimi 30 giorni)
M Fernandes
M Fernandes il 29 Set 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)

Risposte (0)

Categorie

Scopri di più su Random Number Generation in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by