LoslegenKostenlos loslegen

Adding more variables to predict soil pollution

Now let's add additional predictors to the model with spatial interactions.

Diese Übung ist Teil des Kurses

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Kurs anzeigen

Anleitung zur Übung

Fit another model to predict cadmium in the soil, this time including smooths for the effect of elevation (elev) and distance from the river (dist) in addition to an x, y surface.

Interaktive Übung

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

# Fit the model
mod2da <- gam(cadmium ~ s(x, y) ___, 
              data = meuse, method = "REML")

# Inspect the model
summary(mod2da)
Code bearbeiten und ausführen