Change this line sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,2] to sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,1] Because in bootstrap, we calculate estimation $\beta_1$ in each boot and collect them together as a sample of estimator $\hat{\beta}_1$, then calculate the standard deviation of estimator $\hat{\beta}_1$.