/*"lab-3 on asymptotic properties and bootstrapping" Here you have part of the program you need to execute for lab 3. The program finds the sampling distribution of beta1 hat or beta2 hat (if you change the column at the end of the program) by simulation. The distribution of the error is a very improbable one but is useful for showing the difference between the sampling distribution of beta hat for n fixed and the asymptotic distribution of beta hat. Now: 1) Do a bootstrap using the estimations of the first sample (n=20). Use g down below to choose the epsilons hat with replacement. Find the sampling distribution of beta hat. 2) Show, by simulation, that beta hat is a CAN estimator. 3) Perform t-tests using the bootstrap and asymptotic critical values. Compare the two - which is more reliable? 4) Now find the sampling distribution of beta hat with uniform mean zero errors (with variance as big as you want) by simulation (you just have to modify this part of the program already written). Comment on the results."*/ n=20; /*"sample size"*/ m=100; /*"number of repetitions in the experiment"*/ /*"here g will be a vector of random integer numbers from 1 to n each one with the same probability of appearing"*/ a=0.5; g=rndu(n,1); g=a+(n-0.000001)*g; g=round(g); x=rndu(n,1); col1=ones(n,1); x=col1~x; beta={10,1}; betah=zeros(rows(beta),1); i=1; do until i==m+1; e=rndn(n,1) .> 1.96; e=-10*e+(1-e)*10; e=e-meanc(e); beta={10,1}; y=x*beta+e; b=inv(x'x)*x'y; betah=betah~b; i=i+1; endo; betah=betah[.,2:cols(betah)]; betah=betah'; library pgraph; hist(betah[.,1],20);