CommencerCommencer gratuitement

Percentile method - bootstrap CI for slope

Alternatively, a CI for the slope can be created using the percentiles of the distribution of the bootstrapped slope statistics. Recall that a CI is created in such a way that, over a lifetime of analysis, the coverage rate of a CI is (1-alpha)*100%. If you always set alpha = 0.05, then the 95% confidence intervals will capture the parameter of interest (over your lifetime) 95% of the time. Typically, out of the 5% of the time when the interval misses the parameter, sometimes the interval is too high (2.5% of the time) and sometimes the interval is too low (2.5% of the time).

The bootstrapped estimates of slope, boot_slope, are loaded in your workspace.

Cet exercice fait partie du cours

Inference for Linear Regression in R

Afficher le cours

Instructions

  • Set alpha to be 0.05 (although for your own work, feel free to use a different confidence level).
  • Calculate the relevant percentiles needed to create the confidence interval.
    • The lower percentile cutoff is at half alpha.
    • The upper percentile cutoff is at one minus half alpha.
  • Create the confidence interval of stat using quantile() and the percentile cutoffs. Your interval ends should be named lower and upper.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Set alpha
alpha <- ___

# Set the lower percentile cutoff
p_lower <- ___

# Set the upper percentile cutoff
p_upper <- ___

# Create a confidence interval of stat using quantiles
boot_slope %>% 
  ___
Modifier et exécuter le code