Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

R Studio code please ## Bootstrap estimates In this assignment we will explore the technique of bootstrap estimation. Load the iris dataset ```{r} library(dplyr) data(iris)

R Studio code please

## Bootstrap estimates

In this assignment we will explore the technique of bootstrap estimation.

Load the iris dataset

```{r}

library(dplyr)

data(iris)

```

Use the filter command to get the dataframe iris_set, corresponding to the species Setosa.

```{r}

iris_set <-

```

Extract the four variables of iris_set into the vectors: pet_len, pet_wid, sep_len, sep_wid

```{r}

pet_len <- iris_set$Petal.Length

pet_wid <-

sep_len <-

sep_wid <-

```

Recall that a bootstrap sample is obtained by sampling with replacement a sample of size n from a sample of n data values.

A bootstrap point estimate will then be the point estimator evaluate on a given bootstrap sample. We will calculate bootstrap estimates for soame some standard estimators, calculate the empirical expected values, and the bootstrap standard error.

## Bootstrap estimates for the sample mean

Calculate the bootstrap estimates for the sample mean, store these in the vector "boot_means_pet_len" etc and then calculate the standard deviation of this vector to estimate the standard error for sample mean as the point estimator (compare this with the standard error estimated by the Central limit theorem).

Note down your observations.

```{r}

B <- 100000

```

```{r}

# boot_means_pet_len <- replicate(B, mean(sample(pet_len, size = length(pet_len), replace = TRUE)))

# mean(pet_len)

# sd(pet_len)/sqrt(50) #standard error from Central Limit Theorem

# mean(boot_means_pet_len)

# sd(boot_means_pet_len) #bootstrap standard error

```

```{r}

# boot_means_pet_wid <-

```

```{r}

# boot_mean_sep_len <-

```

```{r}

# boot_mean_sep_wid <-

```

## Bootstrap Estimates for the sample standard deviation.

Calculate the bootstrap estimates for the sample standard deviation, store these in the vector "boot_sd_pet_len" etc and then calculate the standard deviation of this vector to estimate the standard error for sample standard deviation as the point estimator.

Note down your observations.

```{r}

# boot_sd_pet_len <- replicate(B, sd(sample(pet_len, size = length(pet_len), replace = TRUE)))

# sd(pet_len)

# mean(boot_sd_pet_len)

# sd(boot_sd_pet_len)

```

```{r}

# boot_sd_pet_wid <-

```

```{r}

# boot_sd_sep_len <-

```

```{r}

# boot_sd_sep_wid <-

```

## Bootstrap Estimates for area of petal.

Recall that the area of an ellipse with major axis $a$ and minor axis $b$ is given by $$ \pi a b.$$

Under the assumption that the shape of the petal of the iris flower is approximately an ellipse with the major and minor axes given by petal length and petal width (or vice versa), we can estimate the petal surface area (only one side) of iris of setosa species by the following estimator:

$$ \hat\theta = \pi \cdot \overline{X}\cdot\overline{Y},$$

where $\overline{X}$ and $\overline{Y}$ are the sample means of petal length and petal width respectively. \\

Estimate the surface area of the petal of a iris setosa flower using the given dataset.

```{r}

# petal_area_set <-

# petal_area_set

```

Now use bootstrap sampling to estimate the standard error in your estimated petal surface area. Make sure you identify the correct output.

```{r}

# boot_pet_area_set <- replicate(B, {

#x <- mean(_____ )

#y <- mean(______)

#pi*x*y

#}

#)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability and Random Processes With Applications to Signal Processing and Communications

Authors: Scott Miller, Donald Childers

2nd edition

123869811, 978-0121726515, 121726517, 978-0130200716, 978-0123869814

More Books

Students also viewed these Mathematics questions

Question

6. What is corporate identity?

Answered: 1 week ago