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.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 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 ...
0
votes
0answers
13 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 ...
0
votes
1answer
7 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 ...
0
votes
0answers
9 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 ...
2
votes
0answers
30 views

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

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 ...
0
votes
0answers
10 views

How to replicate the fit given by lm (basis spline) in gam library mgcv? [closed]

This is my data x = c(8.375000, 8.875000, 9.458333, 9.875000, 10.375000, 10.875000, 11.458333, 11.791667,12.541667, 12.958333, 13.375000, 13.708333, 14.458333, 14.958333) y= c(137.0, 134.0, 136.5, ...
3
votes
1answer
106 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: ...
1
vote
0answers
27 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. ...
1
vote
1answer
33 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, ...
0
votes
0answers
13 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 ...
1
vote
2answers
52 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'...
0
votes
1answer
28 views

How to fit a zero-inflated quasi-poisson distribution to a continuous variable using GAM [closed]

I am trying to fit a GAM to a continuous variable which is zero-inflated. However, since my variable is continuous, I am not able to use ziP() for a zero-inflated quasi-Poisson. Is there someway to ...
1
vote
0answers
20 views

Regression with sparse data - binning or other approaches?

A couple years ago, I built a GAM to predict game sales regressing away team, sales to date, event month, and days to event against final event sales using smoothing parameters over days to event and ...
1
vote
1answer
30 views

Which level of factor (categorical variable) is assigned “the parameter value”?

Here is an example in Zuur's book about GAM. The data file (Bailey fisheries data) and R code (Chapter2.R) can be found in his website. Below I describe what I confuse. We want to exam whether the ...
2
votes
1answer
68 views

GAM factor-smooth interactions and model selection [closed]

I'm working with a dataset which is a long-term animal abundance survey collected from 11 sites, which have different average temperature(also there are some missing years for some sites). Here, the ...
0
votes
0answers
6 views

cvgam for GAMM cross validation

I used cvgam for Cross-validation estimate of accuracy from GAM model fit before. My question is if I can use it for GAMM somehow? Or is there any way that I can perform k-fold cross validation for ...
2
votes
1answer
18 views

the difference between using an AR(1) term (as in GAMM) versus using PM lag variable (in GAM)

I conducted an experiment to predict particulate matter (PM) level using a GAM. To do so I included the lag1 PM (PM value of day before) as well as few meteorological terms. In my second experiment ...
2
votes
1answer
45 views

GAMs & homoscedasticity

Despite my best Googling efforts, I can't find an answer to this simple question: Q: Does a generalised additive model with a link identity function and a Gaussian distribution assume ...
0
votes
0answers
54 views

How can i find a suitable distribution that fits my data?

I have some data on prevalence of a given infection, provided for each country for 6 different age groups. I am trying to find a suitable distribution that may be suitable to model capture the ...
0
votes
0answers
13 views

Modeling variable recensus/exposure count data using gam, quasipoisson with cloglog link

I am modeling tree recruitment in a forest. Foresters visit a forest monitoring plot twice. Recruitment is defined as the number of trees above a certain size threshold that are in the second census, ...
3
votes
1answer
47 views

GAM factor smooth interaction--include main effect smooth?

I am working with a dataset it which I am interested in modeling an age*sex interaction in the GAMM framework. From examples I have seen and documentation I have read, this is typically accomplished ...
0
votes
0answers
15 views

Are residuals meaningful when using additive, robust, and regularization models on time series

If I am using additive models, regularization, or robust regression to model time series data, should I still check that the residuals have no autocorrelation and are stationary? I am under the ...
0
votes
1answer
45 views

implement lasso Regression in GAMs in R

Hello I search a way to select variables in a gam function R by using Lasso Regression. I already fitted a model gam(y~x) with x ...
0
votes
0answers
22 views

R: how to get effective degrees of freedom?

I'm building a sparse additive model and using the Generalized Cross Validation score for a linear smoother $\hat f(x) = L(x) \underline Y$ $$GCV(\lambda) = \frac 1n \sum_{i=1}^n \left( \frac{Y_i - \...
0
votes
0answers
14 views

intervention analysis with multivariate regression

Does intervention analysis make sense when one has multiple external regressors? How would one know if say, a level shift, is caused by a combination of external regressors or by a change in a law ...
0
votes
0answers
352 views

Should I be concerned about the warning message in model.matrix.default() - non-list contrasts argument ignored?

I am running a GAMM (mgcv package) with percentage/proportion as the dependent variable and a mixture of categorical and continuous variables, after running most of my models, this is the warning ...
1
vote
0answers
29 views

Include main effect when specifying varying coefficient models with GAMM?

I am trying to model an interaction between two continuous variables in the GAMM framework using gamm in R. For simplicity's sake, I am ignoring the repeated ...
0
votes
2answers
60 views

Is it possible to make this GAM even less smooth to generate a better fit?

I have done a logistic regression with two independent variables (x1 and x2) and a dependent binary variable (y). The AUC (roc curve) is 0.7915. The heatmap below shows the probabilities resulting ...
0
votes
1answer
28 views

Different machine learning models give contradictory results

I am relatively new to data analysis using machine learning and i got following problem while doing this machine learning problem. I have a data set with 80 features of 250 observations (rows) (but ...
0
votes
1answer
28 views

Why do my splines become not more flexible after altering the parameters in R mgcv?

I have done a logistic regression with two independent variables (x1 and x2) and a dependent binary variable (y). The AUC (roc curve) is 0.7915. After making a heatmap, I noticed the logistic ...
0
votes
0answers
18 views

GAM betar, Deviance explained is more than 100%?

It is my first time using GAM, However I am having a challenging issue: I am getting “Deviance explained = 102%” and I don’t know how we suppose to interpret it.Does it relate to the warning message ...
2
votes
1answer
29 views

Should I use Poisson or Gaussian family in GAM?

I would like to ask if I am right to use a Gaussian family in my GAM analysis. I have some count data of the number of animals captured per 100 traps, which is not normally distributed. Then I did a ...
0
votes
1answer
56 views

Plotting summed effects of factor levels in interactions in a GAMM model

I am new in GAMM and I am analyzing a data to find the effect of year, tree species and their interaction on richness of insects on the trees. I expect that year will have an overall nonlinear effect. ...
1
vote
1answer
30 views

Need to center continuous variables in GAMs?

This is just a quick question, but I remember reading somewhere that continuous variables used in splines for generalized additive models ought to be centered (especially for GAMs rather than just as ...
0
votes
0answers
25 views

Can someone explain me how cumulative association in distributed lag models works?

I'm trying to fit some distributed lag models with dlnm package in R. When I specify cumul=TRUE, I obtain extra parameters ...
4
votes
0answers
45 views

When to choose regression splines over smoothing splines? [duplicate]

I am currently studying how to model covariates beyond linearity in order to use them with GAMs for regression / classification purposes. Talking about splines, two types were presented: regression ...
0
votes
1answer
20 views

Potential use of GAM's in Python to evaluate dataset

I'm working with a dataset of >100k rows that includes 4 columns: ['Person','x_value','y_value','binary_response'] My goal is to able to run tests to evaluate ...
0
votes
0answers
23 views

solution to non linear correlations in glm

I'm doing a glm to test the relation between one variable with diferent climatic variables. Nothing is significative and I think maybe the problem is that the relation between the variables is not ...
2
votes
1answer
26 views

what are the intercepts in mgcv's ordered-factor difference smooths?

I aim to plot the gam() model fit back on the original data. My impression was that gam() has special treatment for ordered ...
0
votes
0answers
21 views

GAM model residuals

I have a huge problem with my model. I did a GAM Model with negative binomial distribution (with mgcv library). Now I want to do an overdispersion test but I think that this doesn't exist for ...
0
votes
0answers
10 views

Confidence in model selection

I have a Gam model built for a time series study over 15 study sites for ecological analysis. I have run the model and I have a significant intercept, ecologically sound significant results, 55% ...
1
vote
0answers
26 views

GAM goodness-of-fit under covariates shift

I have GAM models that were fitted using PyGAM and its defaults for fitting a linear GAM. To validate the model I do a leave-one-out cross-validation looking at either a Spearman's rank correlation ...
3
votes
1answer
34 views

How does one intuitively interpret significance of splines/GAM term?

Consider the data dput here. I can predict y from x using a cubic spline: ...
1
vote
1answer
51 views

GAM discrete time survival prediction in R [closed]

So I've been trying to perform a discrete time survival analysis in R. I have been using the discSurv package to generate the augmented data matrix for the full ...
2
votes
1answer
33 views

significance of difference smooths

I am working to understand what is represented by the standard errors and confidence intervals of smooths of ordered factors. In this toy example, I wish to determine (1) the overall form of the trend ...
1
vote
0answers
23 views

concurvity in presence of random smooths [closed]

I am trying to fit a GAMM containing per subject random smooths using the bam function in mgcv as follows: ...
2
votes
1answer
39 views

Why does “ smooth term” have “parametric” effect?

I read a blog about Generalized Additive Model (GAM). In this blog, the author used summary(gam1), then some information is printed: ...
0
votes
0answers
62 views

zero inflated presence absence binomial GAM in R

I am fitting a binomial GAM using mgcv in R. My data is presence (1)/ absence(0) of dolphin acoustic detections in 10 minute time windows over ~1 year period. However, I have only ~750 presences to ~...
1
vote
2answers
39 views

Is there a maximum number of independent variables for generalized additive model?

I noticed that we sometimes pick the indenpendent variables into the GAM model, but don't consider if we have add "too many" of them. For example, if I have a dataset with 100 observations, what is ...
0
votes
0answers
8 views

Performing a GAM with correct error distribution and smoothing functions

I'm applying a GAM from package mgcv using two continuous explanatory variables with a binomial response. What would be the best error distribution to use (Family and link)?