adv-r icon indicating copy to clipboard operation
adv-r copied to clipboard

Typo in Exercise 1 of 10.4.4?

Open djbirke opened this issue 2 years ago • 0 comments

Exercise 1 of 10.4.4 asks

In boot_model(), why don’t I need to force the evaluation of df or model?

However, boot_model() does not look up model (except as a default in lm):

boot_model <- function(df, formula) {
  mod <- lm(formula, data = df)
  fitted <- unname(fitted(mod))
  resid <- unname(resid(mod))
  rm(mod)

  function() {
    fitted + sample(resid)
  }
} 

Is this a typo with the correct formulation as follows?

In boot_model(), why don’t I need to force the evaluation of df or formula?

djbirke avatar Jul 10 '22 05:07 djbirke