This problem makes use of the Carseats dataset in he ISLR2 package.

Questions

  1. For each quantitative variable in the dataset besides Sales, fit a linear model to predict Sales using that quantitative variable. Report the p-values associated with the coefficients for the variables. That is, for each model of the form \(Y = \beta_0 + \beta_1 X + \epsilon\), report the p-value associated with the coefficient \(\beta_1\). Here, \(Y\) represents Sales and \(X\) represents one of the other quantitative variables. Store the p-values in a variable p.values. (check the example code below)

  2. Suppose we control the Type I error at level \(\alpha = 0.05\) for the p-values obtained in the first exercise. Which null hypotheses do we reject? Store your answer in the variable rejected.null.hypotheses. Hint: you can make use of the function which().

  3. Now suppose we control the FWER at level 0.05 for the p-values. There are 2 possible methods to do this.
    MC1: Which method is the least conservative?
    1. Bonferroni
    2. Holm

    Which null hypotheses do we reject using that least conservative method? Store the adjusted p-values in p.values.fwer and store your answer in the variable rejected.null.hypotheses.FWER.

  4. Finally, suppose we control the FDR at level 0.2 for the p-values. Which null hypotheses do we reject? Store the adjusted p-values in p.values.fdr and store your answer in the variable rejected.null.hypotheses.FDR.

Assume that: