LoslegenKostenlos loslegen

Teasing apart multi-scale interactions

In the previous exercise, you fit the following model:

tensor_mod <- gam(cadmium ~ te(x, y, elev), 
                  data = meuse, method = "REML")

In this exercise, you will fit a model with smooths and tensor interactions to separate out the independent and interacting effects of variables.

Diese Übung ist Teil des Kurses

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Kurs anzeigen

Anleitung zur Übung

  • Convert the above model such that x and y interact on the same scale, the effect elev is a separate smooth, and the interaction of all three on different scales is a separate term.
  • Summarize and plot the model.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Fit the model
tensor_mod2 <- ___


# Summarize and plot
___
___(___, pages = 1)
Code bearbeiten und ausführen