Questions tagged [generalized-additive-model]

749 questions
76
votes
4 answers

Why does including latitude and longitude in a GAM account for spatial autocorrelation?

I have produced generalized additive models for deforestation. To account for spatial-autocorrelation, I have included latitude and longitude as a smoothed, interaction term (i.e. s(x,y)). I've based this on reading many papers where the authors say…
gisol
  • 943
  • 1
  • 8
  • 10
34
votes
3 answers

When to use a GAM vs GLM

I realize this may be a potentially broad question, but I was wondering whether there are assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)? Someone recently told me that GAMs should only…
32
votes
1 answer

Can degrees of freedom be a non-integer number?

When I use GAM, it gives me residual DF is $26.6$ (last line in the code). What does that mean? Going beyond GAM example, In general, can the number of degrees of freedom be a non-integer number? > library(gam) >…
Haitao Du
  • 32,885
  • 17
  • 118
  • 213
30
votes
2 answers

How to include an interaction term in GAM?

The following code evaluates the similarity between two time series: set.seed(10) RandData <- rnorm(8760*2) America <- rep(c('NewYork','Miami'),each=8760) Date = seq(from=as.POSIXct("1991-01-01 00:00"), to=as.POSIXct("1991-12-31…
KatyB
  • 909
  • 2
  • 12
  • 17
20
votes
2 answers

Generalized additive models -- who does research on them besides Simon Wood?

I use GAMs more and more. When I go to provide references for their various components (smoothing parameter selection, various spline bases, p-values of smooth terms), they are all from one researcher -- Simon Wood, at the University of Bath, in…
19
votes
3 answers

Confidence interval for GAM model

Reading mgcv::gam's help page: confidence/credible intervals are readily available for any quantity predicted using a fitted model However I can't figure a way to actually get one. I thought predict.gam would have a type=confidence and a level…
George Dontas
  • 6,154
  • 3
  • 34
  • 49
17
votes
1 answer

Summary of a GAM fit

If we fit a GAM like: gam.fit = gam::gam(Outstate ~ Private + s(Room.Board, df = 2) + s(PhD, df = 2) + s(perc.alumni, df = 2) + s(Expend, df = 5) + s(Grad.Rate, df = 2), data = College) Where, we use the dataset College, that can be found…
Mooncrater
  • 737
  • 2
  • 9
  • 19
17
votes
3 answers

Generalized Additive Model Python Libraries

I know that R has gam and mgcv libraries for generalized additive models. But I am having difficulty finding their counterparts in the Python ecosystem (statsmodels only has prototype in the sandbox). Is anyone aware of existing python libraries? …
Pylander
  • 425
  • 1
  • 4
  • 10
15
votes
1 answer

Generalized additive models (GAMs), interactions, and covariates

I've been exploring a number of tools for forecasting, and have found Generalized Additive Models (GAMs) to have the most potential for this purpose. GAMs are great! They allow for complex models to be specified very succinctly. However, that same…
jdobres
  • 338
  • 2
  • 10
15
votes
1 answer

Adaptive GAM smooths in mgcv

Simon Wood's book on GAMs and his associated R package mgcv are both highly detailed and informative when it comes to GAM theory and model-fitting to real and simulated data. For 1D smooths, there is really not much to worry about, save for…
compbiostats
  • 1,017
  • 9
  • 18
15
votes
1 answer

GAM vs LOESS vs splines

Context: I want to draw a line in a scatterplot that doesn't appear parametric, therefore I am using geom_smooth() in ggplot in R. It automatically returns geom_smooth: method="auto" and size of largest group is >=1000, so using gam with formula: y…
14
votes
1 answer

R/mgcv: Why do te() and ti() tensor products produce different surfaces?

The mgcv package for R has two functions for fitting tensor product interactions: te() and ti(). I understand the basic division of labour between the two (fitting a non-linear interaction vs. decomposing this interaction into main effects and an…
jvh_ch
  • 313
  • 2
  • 9
13
votes
0 answers

Penalized spline confidence intervals based on cluster-sandwich VCV

This is my first post here, but I've benefited a lot from this forum's results popping up in google search results. I've been teaching myself semi-parametric regression using penalized splines. Basically, $$ \hat{y} = X(X'X + \lambda…
13
votes
1 answer

How to choose the type of GAM-parameters

I have started to work with GAM in R and I’ve acquired Simon Wood’s excellent book on the topic ("Generalized Additive Models An Introduction with R"). Based on one of his examples, I am looking at the…
12
votes
2 answers

Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or logarithmic curves instead. Which to use?

I am trying to publish my Masters thesis which looked at elephant impacts on vegetation, with a focus on the effect of artificial waterholes. I have made my initial submission and am now performing major revision, which involves some questioning of…
1
2 3
49 50