Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Simulation for Data Science with R

You're reading from   Simulation for Data Science with R Effective Data-driven Decision Making

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781785881169
Length 398 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Matthias Templ Matthias Templ
Author Profile Icon Matthias Templ
Matthias Templ
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introduction 2. R and High-Performance Computing FREE CHAPTER 3. The Discrepancy between Pencil-Driven Theory and Data-Driven Computational Solutions 4. Simulation of Random Numbers 5. Monte Carlo Methods for Optimization Problems 6. Probability Theory Shown by Simulation 7. Resampling Methods 8. Applications of Resampling Methods and Monte Carlo Tests 9. The EM Algorithm 10. Simulation with Complex Data 11. System Dynamics and Agent-Based Models Index

Estimation of standard errors with bootstrapping


In the following, we discuss the bootstrap in detail also by taking hands-on R. Before the estimation of the standard error is in focus, some definitions are repeated in more detail.

Let's consider the following toy example with the following seven numbers. We use such a small sample and toy example just to explain the bootstrap in R. The estimator of interest should be the arithmetic mean in our example:

x <- c(5, 7, 8, 2, 15, 12, 3)

We next define the bootstrap sample. A bootstrap sample is random sample

with replacement from the sample . One bootstrap sample is given by:

## for reproducibility we use a seed
set.seed (123)
## bootstrap sample (with replacement)
s1 <- sample(x, replace = TRUE)
s1
## [1]  8 12  8  3  3  5  2

We see that this bootstrap sample does not include a 7 and a 15, but two times the 3 and 8. This can happen since we sample with replacement, meaning that if we draw a number, it will be replaced so that the next...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime