# How to Bootstrap in R: The Case of R-squared

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I recorded a new video tutorial whose original intent was to demonstrate how to write a for loop. As I wanted to make the for loop count for something, I decided that my application would be to write some code that computes the bootstrap approximation to the sampling distribution. This is a common econometric application. **Coffee and Econometrics in the Morning**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Here is the video where I describe the code and the method.

As with most of the videos here, I am merely describing the application. You should understand why you want to bootstrap before you consider running this code (unless you just want to see a for loop in action).

Here is the code I used:

I am not going to post the data on this one, but the code should be easy to modify to work with any data set you use.

To

**leave a comment**for the author, please follow the link and comment on their blog:**Coffee and Econometrics in the Morning**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.