load_mgcv()
# simulate some Gaussian data
df <- data_sim("eg1", n = 50, seed = 2)
# fit a GAM with 1 smooth and 1 linear term
m1 <- gam(y ~ s(x2, k = 7) + x1, data = df, method = "REML")
model_vars(m1)
# fit a lm with two linear terms
m2 <- lm(y ~ x2 + x1, data = df)
model_vars(m2)
Run the code above in your browser using DataLab