\begin{Schunk}
\begin{Sinput}
 res <- lapply(mregs, summary)
 b1hat <- vector(nsims, mode="numeric")
 for (i in 1:nsims){ b1hat[i] <- coefficients(res[[i]])[2,1]}
 hist(b1hat, breaks=20, probability=T, main="", xlab="Estimates of b1")
 lines(density(b1hat), lty=4)
 rb1hat <- range(b1hat)
 xseq <- seq(from=rb1hat[1],to=rb1hat[2],length.out=200)
 nseq <- dnorm(xseq, m=b1, s=0.1)
 lines(xseq, nseq, lty=1)
 legend("topright",legend=c("Simulated kde","Theoretical"), lty=c(4,1))
 legend("topleft", legend=c(paste("mean=",round(mean(b1hat),3)),paste("std.dev.=",round(sd(b1hat),3)) ))
\end{Sinput}
\end{Schunk}
