Session Ready
Exercise

Using smoothing parameters to avoid overfitting

The smoothing parameter balances between likelihood and wiggliness to optimize model fit. Here, you'll examine smoothing parameters and will fit models with different fixed smoothing parameters.

Instructions
100 XP
  • View the value of the smoothing parameter (\(\lambda\)) of the provided gam_mod model by extracting the sp value from the model.
  • Fit two models to the mcycle data with accel as a smooth function of times and a smoothing parameter of:
    • 0.1
    • 0.0001
  • Visualize both models.