- Use the following function to calculate the bootstrapped estimate for the correlation between
age
and weight
on the boys
data set. Use R=1000
bootstrap samples.
corfun <- function(data, i){
data.sample <- data[i,]
stat <- cor(data.sample$age, data.sample$wgt, use = "pairwise.complete.obs")
return(stat)
}
- Explore the contents of the
bootstr.cor
object. For example, use function attributes()
to see the listed dimensions that are within the bootstr.cor
object and the class
of the object.
- Plot the histogram of the individual bootstrapped estimates for every bootstrapped sample (i.e.
$t
).
- Add a column to boys that indicates whether boys are overweight by taking the boundary
bmi > 25
.
- Bootstrap a \(X^2\)-test that evaluates the distribution of overweight
ovw
boys over the regions reg
.
- Plot the histogram of the individual bootstrapped estimates for every bootstrapped sample (i.e.
$t
).
- Do a bootstrap of the regression estimates of the following model:
lm(wgt ~ age + hgt + I(hgt^2))
- ** Create a histogram of the individual bootstrapped estimates **
- Calculate the confidence intervals for
End of Practical