ComenzarEmpieza gratis

Writing formulas for GAM models

When using gam() (docs) to model outcome as an additive function of the inputs, you can use the s() (docs) function inside formulas to designate that you want to use a spline to model the non-linear relationship of a continuous variable to the outcome.

Suppose that you want to predict how much weight (Wtloss) a dieter will lose over a 2-year diet plan as a function of:

  • Diet type (categorical)
  • Sex (categorical)
  • Age at beginning of diet (continuous)
  • BMI (body mass index) at beginning of diet (continuous)

You do not want to assume that any of the relationships are linear.

Which is the most appropriate formula?

Este ejercicio forma parte del curso

Supervised Learning in R: Regression

Ver curso

Ejercicio interactivo práctico

Pon en práctica la teoría con uno de nuestros ejercicios interactivos

Empieza el ejercicio