# Questions tagged [gam]

Generalized additive model (GAM) is a generalized linear model (GLM) in which the response variable depends on unknown smooth functions of some predictor variables.

512 questions
Filter by
Sorted by
Tagged with
19 views

### Neighborhood matrix in spatio-temporal model

I am attempting to create a neighborhood matrix (poly2nb in spdep) in R to use either for a GAM or an INLA. As I have spatio-...
28 views

### GAM: Modelling rate of change with non-linear interaction

I want to model the rate of change of Y as (ΔY=Yt-Yt-1) as a function of x1, x2. For that I'm using a GAM model with an interaction as following: ...
25 views

### Scale of time covariate in corCAR1() matters?

I'm running a bunch of GAM analyses on time series data (measurements of my own weight). Unlike many examples I see online, my data is not spaced evenly in time. In fact, time points can come minutes ...
24 views

### What is the difference in between quasi-Poisson regression model and generalized additive models? On what basis do we choose these models? [closed]

I read some papers where some authors used one model to the other, I tried to find the underlying assumption behind the model but can't fully understand it. It is not clearly mentioned. One reason I ...
90 views

### Representing a GAM with truncated power basis as a mixed model

The truncated power basis looks like this: $$y = \theta_0 + \theta_1x + \theta_2x^2 + ... + \theta_dx^d + \sum_{k=1}^K \theta_{dk}(x-\kappa_k)_+^d$$ Apparently, you can just separate the ...
33 views

### Which model to choose for time of day as a dependent variable having a skewed periodic/rhythmic relationship with some response?

I have a data-set with time of day (0 - 24 hours) as a dependent variable together with some continuous response variable which demonstrate what looks like a skewed sine relationship. For ...
59 views

### Based on the graph & table, what method is used for the analysis that has been started on the table pictured?

Looking at the time-series plot of data (pictured), and looking at the table (pictured), what method and why has been chosen for the analysis that has been started on the table shown? I'm struggling ...
116 views

### How to test for the best parameters for transformed independent variable in linear model

Let's assume that I have a linear model with $k$ variables: $y = \beta_0 + \beta_1\cdot x_1 + \dots + \beta_k \cdot x_k$. Now, I want to add variable $x_{k+1}$, but, according to domain knowledge, ...
9 views

### Getting the right interaction structure (continous and categorical) in GAM and intepreting p-values

I have looked long and hard to better understand implementing the right interaction structure in GAM and am aware of similar posts out there so I apologise for that, however I'm still unsure sure how ...
25 views

### Time series regression analysis with GAM in a factorial design

I have data from 16 automated sensors that measure a parameter across 4 experimental treatments with 4 replicated experimental units each: How would I go about to robustly test for significant ...
25 views

### Aggregating sales forecasts from mutually exclusive segments

I am using generalized additive models (GAMs) to forecast sales for 16 mutually exclusive and exhaustive customer segments. There are naturally correlations in these 16 series, including seasonal ...
57 views

### GAM Interactions : Individual and Combined Interactions are different

I am quite new to GAM, I was trying various interactions in my GAM models, the individuals interactions and combined interactions are not coming up the same. There are three variables which define my ...
30 views

### Why these three models suggest such a great difference on the significance

Does someone could tell me why these three models suggest such a great difference on the significance of factors? And which one is much reasonable? ...
28 views

### calculating percentiles (quantiles) from GAM predictions in R

I'm working with a bird migration dataset, and exploring some different metrics to quantify changes in migration phenology (timing) over several decades. There are many different approaches to do this,...
31 views

### Need some eyes on my dataset: can we argue here that there is a random spread around a constant?

I have this huge data set where I am looking to find trends. However, this one quantity (Figure) seems to randomly spread around an almost constant line (with the exception between 1600-2300). I did ...
46 views

### Similar to beta regression for Generalized Additive Models and Generalized Linear Models

My thesis is based on GAM and GLM. But my dependent variable is a proportion, meaning that $y \in (0,1)$ then I thought a better fit for this was the beta regression but this one is not considered in ...
36 views

### For non-parametric regression which one has better interpretation and properties, GAM or quantile regression?

As in the topic. I want to interpret data for which I have no clues about the distribution. It's neither count, percentage, continuous. I don't want any transformations. Instead I would like to ...
22 views

### Representation of cubic-linear spline in mgcv::gam

I have a dataset of empirical hazard rates which I would like to model to produce a reasonable forecast of the survival rate. I'd like to use a cubic-linear spline to fit the logit-transformed hazards ...
19 views

### Computational time of a (fairly complex) GAM with ARMA structure in brms

I am fitting a model for time-series analysis of Wikipedia views with STAN through the brms package. I came up with a pretty good distributional model, which ...
12 views

### ordered variables in GLM vs GAM

I'm trying to find the best model from a dataset which mainly has ordinal variables (in likert scale). So, I don't know since I had to put in GLM as.factor do I ...
105 views

### When and why would you not want to use a GAM?

I understand that GAMs in mgcv have the ability to reduce s(x) to a linear relationship with the response variable. If this is the case, why wouldn't you use a GAM? ...
12 views

### anova.gam, significant test and 0 deviance

I have fitted a series of GAMs of increasing complexity, and compared with anova.gam. I get a significant p value (based on Chisq test) for a pair of models, even though the difference in deviance ...
40 views

### Acceptable/reasonable deviance explained for fitted GAM?

thanks to all for any help in advance. I have built a series of nested GAMs in mgcv to explain the presence/absence of antibodies in a population of animals and used AIC to select my best fitting ...
39 views

### Autocorrelated residuals in GAM even with lagged variables or AR process

I'm using GAMs to model ozone as a predictor, and using time , temperature and another pollutant (poll) as covariates. I have 20 years hourly data (large dataset), but I'm using 2 periods of 10 years, ...
23 views

### ANOVA for natural splines

I want to use ANOVA for selecting the best model with two independent variables, where either one of them (or both) can be fitted with natural splines. Hence, I try the following models: ...
26 views

### Unusual residual artefacts in GLMM, is GAM or another model more appropriate?

I'm having trouble finding an appropriate model for my data. The data comprises behavioural observations of chimpanzees, where I instantaneously sampled their locomotor behaviours and parameters of ...
53 views

### Interpreting a pattern in a residual plot produced by gam.check()

I'm working on creating a model that examines the effect of ocean characteristics on fishing outcomes. I have spatial data on a 0.5 degree grid and I created the following model: ...
361 views

### Smooth bivariate interaction decomposition in GAM models

Background Consider the following additive model containing a smooth bivariate interaction term: $y = f(x,z) + \epsilon$ where y is a continuous outcome variable, x and z are continuous ...
97 views

### How does random variable nesting in GAMs work (mgcv)?

Consider me very new to the world of GAMs, I am actually using it out of necessity rather than by choice but I thought it could be a chance to learn something new anyway. Originally I had hoped to ...
39 views

### How does weights argument in gam() to handle the heterogeneous variance issues

In my case there were multiple observations per Group(random effect) in a single Year. So I aggregate these cases by calculating ...
48 views

### Make Nonlinear Smooth Interpretable in Logistic GAM Regression

I have a nonlinear smooth fit in a logistic regression from the package mgcv in R. Visualizing the smooth, the y-axis I get using either ...
36 views

### How to formulate nested random effects in gam

I'm interested in how growth of a fish species is related to several environmental variables. Those variables are measured at the time of capture, but several fish can be captured in a single sample (...
12 views

### Can we get the specific formulation form of thin plate regression spline in GAM?

In mgcv package, the default smoother is thin plate regression spline. After building a GAM model, can we "write" the formula form of the thin plate regression ...
14 views

### Understanding how to weight variables

I am trying to model the "recruitment" of a deer population where recruitment is a factor of "females counted in fall" and "fawns counted in fall". e.g femaleFall:fawnsFall = Recruitment. In some ...
28 views

### Conditional Independence in generalized additive models

I'm grappling with a question that I think I know the answer to, but not able to prove it mathematically. I have two oils, which are each run once on an engine across ~800 seconds while the engine ...
13 views

### What are the alternatives to basis functions like a B-spline or polynomial?

Let $f_1, ..., f_n$ be basis functions so that we consider $F = \sum f_i \alpha_i$ where $\alpha_i \in R$ are constants. This is what we do when we use e.g. generalized additive models. I am ...
18 views

### Investigating trends (is joinpoint good?)

In investigating trends in surveillance (especially cancer). Joinpoint (https://surveillance.cancer.gov/joinpoint/) is often used. Joinpoint simply estimates a segmented regression with cutpoints (...
102 views

### How interaction terms are treated in Gradient Boosting?

In GAMs interaction terms have to be expressly specified as covariates, even for simple linear relationships. On the contrary, with Gradient boosting this is not nesessary because the algorithm itself ...
21 views

### Linear combine non-linear transformations

Could someone tell me what it is called if you linear combine a non-linear transformation such as: $$y_i = \beta_1 f(x_{1i}) + \beta_2 f(x_{2i}) + \ldots + \beta_n f(x_{ni}),$$ where $f(\cdot)$ is a ...
51 views

### Interpolating time ordered smooth function into space

I am using GAMs in R to generate daily weather variables, mainly precipitation and temperature. Currently, I am fitting a model for each weather station but I would like to use it in places where ...
34 views

### Marginal effects of a smooth in a gamm4 model

I'm trying to obtain marginal effects of a smooth in a {gamm4} model. I notice a discrepancy between what {ggeffects} gives me and what I get manually. For a smooth x0, I calcualte the predictions ...
78 views

### rules determining nesting in generalized additive models

I understand the concept of nesting when all of the free parameters are clearly identified in linear or generalized linear models (one model is nested within another if its free parameters are a ...
60 views

### GAM model: Group-specific smoothers with different wiggliness of two random and nested factors [closed]

I aim to model the specific seasonal population fluctuations of several species. In particular, I have the abundance of individual along several years of 20 populations belonging to 5 species, and I ...
355 views

### visreg visualization of mgcv results (GAM)

I fitted a GAM with random effects using mgcv, and I've noticed that the visualization of the smooths using visreg does not appear to match the output of mgcv's plots: ...
40 views

### First derivative of splines in bayesian model

Inspired by this post https://www.fromthebottomoftheheap.net/2014/05/15/identifying-periods-of-change-with-gams/, I'm trying to identify periods of change in a GAM model, using bayesian inference. ...
92 views

### Why is there “residual dots” in plot() of GAM?

After building a generalized additive model (GAM) using mgcv package, we can use the plot function to visualize the smoother, ...
15 views

### Regression with a growing year over year dataset

I created a hierarchical GAM to model final event sales as a function of sales to date, days until event, teams that are playing, and event month with a grouping at the home team level. This yielded ...
60 views

### For a mixed model, does the temporal correlation should be checked for each site (random effect)?

When a model fitted in a dataset with multiple time series from different sites, does the temporal correlation should check for each site? And if some sites show auto-correlation but some don't, what'...