# Tag Info

Accepted

### Adaptive GAM smooths in mgcv

Most of the extra smooths in the mgcv toolbox are really there for specialist applications — you can largely ignore them for general GAMs, especially univariate smooths (you don't need a random ...
Accepted

### ANOVA to compare models

The output from anova() is a series of likelihood ratio tests. The lines in the output are: The first line in the output corresponds to the simplest model with ...

### Smoothing methods for gam in mgcv package?

mgcv uses a thin plate spline basis as the default basis for it's smooth terms. To be honest it likely makes little difference in many applications which of these you choose, though in some situations ...
Accepted

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

These are superficially the same model but in practice when fitting there are some subtle differences. One important difference is that the model with ti() terms is ...

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

There are many researchers on GAMs: it's just that basically the same model (GLM with linear predictor given by sum of smooth functions) is given lots of different names. You'll find models that you ...
Accepted

### Model selection for GAM in R

If you want to select from among a group of covariates, then a principled way of doing this is to put some additional shrinkage on each of the smoothers in the model so that they can be penalised out ...
Accepted

### Generalized additive models (GAMs), interactions, and covariates

Q1 What's the difference between models 3 and 4? Model 3 is a purely additive model $$y = \alpha + f_1(x) + f_2(w) + \varepsilon$$ so we have a constant $\alpha$ plus the smooth effect of $x$ plus ...
Accepted

### Two methods of adding random effects to a GAM give very different results. Why is this and which one should be used?

I suspect the difference is in terms of what fitted values you are getting. If you look at what I would call the model fit, the coefficient estimates, variance terms, the models are identical. Compare ...
Accepted

### Different ways of modelling interactions between continuous and categorical predictors in GAM

gam1 and gam2 are fine; they are different models, although they are trying to do the same thing, which is model group-specific ...

### How to choose the type of GAM-parameters

I'm assuming this is better explained in the 2nd edition of Simon's book (which should be out in a couple of days) as he and his students only worked out some of the theory for this years after Simon ...
Accepted

### Choosing k in mgcv's gam()

There is some confusion here and in the answer by @Ira S in that linked post. The default value of the argument k is ...
Accepted

### Correcting for multiple pairwise comparisons with GAM objects {mgcv} in R

The glht() function for generalized linear hypotheses from the multcomp package can be used to carry out various kinds of ...
Accepted

### Time series analysis via generalized additive models: model assumptions and stationarity

The idea here is that by estimating the trend as a smooth function, the residuals then are a stationary process and the ARMA model is being estimated in the residuals. In other words, the estimated ...
Accepted

### Predicting mean smooth in GAM with smooth-by-random-factor interaction

The solution suggested by Simon Wood to the simpler problem of predicting the population level effect from a model with random intercepts represented as a smooth is to use a ...
Accepted

### GAM factor smooth interaction--include main effect smooth?

You need to be careful with ordered factors here in mgcv as they aren't doing what I think you want to be fitting. If you pass an ordered factor to by, then ...
Accepted

### Random effects in Generalised Additive Model - mgcv package

The random effects in mgcv are proper random effects; there is a way to view random effects, penalized smooths, Gaussian processes, & Gaussian Markov Random Fields all as a Gaussian random field. ...

### Generalized Additive Model interpretation with ordered categorical family in R

In these models, the linear predictor is a latent variable, with estimated thresholds $t_i$ that mark the transitions between levels of the ordered categorical response. The plots you show in the ...
Accepted

### Why are generalized additive models (GAMs) so popular in ecology?

TL;DR: GAMs are useful models when specific functional relationships are not hypothesized. Ecology as a science (and like many other sciences, particularly population sciences) often has hypotheses ...

### GAM model selection

If you are using an extra penalty on each term, you can just fit the model and you are done (from the point of view of selection). The point of these penalties is allow for shrinkage of the perfectly ...
Accepted

### Gaussian Process smooths in mgcv: choosing between spherical and exponential covariance functions

The gp smooth type is only discussed in the second edition of Simon's book as it was added to the mgcv long after the first edition went to press. The main ...

### GAM with categorical variables - interpretation

In a factor by variable smooth, like other simple smooths, the bases for the smooths are subject to identifiability constraints. If you just naively computed the ...
Accepted

### Why is my design matrix rank deficient? (modelling seasonal data with a cyclic spline)

cyclicSpline already contains the constant vector in its span so if you additionally add an intercept it'll be rank deficient. ...
Accepted

### gam smoother vs parametric term (concurvity difference)

The concurvity moves from the stated smooth terms to the parametric terms, which concurvity groups in total under the para ...
Accepted

### Are GAM models linear in the parameters?

Yes, GAMs are linear in the parameters. If we ignore the estimation of smoothness parameters, once we have created the bases for all the covariates we want to fit a smooth effects of, a GAM is just ...
Accepted

### Plotting GAMs on Response Scale with Multiple Smooth and Linear Terms

If the model contains z then the effect of x estimated by the model is that given z is in ...
Accepted

### MGCV summary function extremely slow

The test for random effects is extremely costly computation-wise, especially so if there are lots of levels in the random effect factor. Use ...

### mgcv::gam overfitting

The problem is what you mean by 'smooth' here. If you really want a curve that is smooth w.r.t. time and passes through the spike in the data at time 1 then it will have to vary enormously on the y ...
Accepted

### Simulating Responses from fitted Generalized Additive Model

I'll illustrate with the classic 4 term data set oft used to illustrate GAMs, but will only simulate data from the strongly nonlinear term $f(x_2)$ as it is easy to visualise the process with a single ...