Basis Functions and Smoothing

R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Noam Ross

Senior Research Scientist, EcoHealth Alliance

Getting the right fit

  • Close to the data (avoiding under-fitting)
  • Not fitting the noise (avoiding over-fitting)
R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Balancing Wiggliness

$$\LARGE \text{Fit} = \text{Likelihood} - \lambda \times \text{Wiggliness}$$

R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Choosing the right smoothing parameter

R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Smoothing syntax

Setting a fixed smoothing parameter

gam(y ~ s(x), data = dat, sp = 0.1)
gam(y ~ s(x, sp = 0.1), data = dat)

Smoothing via restricted maximum likelihood

gam(y ~ s(x), data = dat, method = "REML")
R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Number of basis functions

R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Basis function syntax

Setting number of basis functions

gam(y ~ s(x, k = 3), data = dat, method = "REML")

gam(y ~ s(x, k = 10), data = dat, method = "REML")

Use the defaults

gam(y ~ s(x), data = dat, method = "REML")
R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Let's practice!

R ile Genelleştirilmiş Katkılı Modeller (GAM'ler) ile Doğrusal Olmayan Modelle

Preparing Video For Download...