Questions tagged [mgcv]

mgcv is a R package for mixed GAM computation vehicle with GCV/AIC/REML smoothness estimation.

Filter by
Sorted by
Tagged with
2
votes
0answers
31 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 ...
3
votes
1answer
111 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: ...
0
votes
1answer
29 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 ...
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
51 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
396 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 ...
0
votes
1answer
29 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 ...
1
vote
1answer
32 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 ...
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 ...
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: ...
0
votes
0answers
66 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
1answer
59 views

Using GAM outside statistical modelling software (in-datatabase, outside R)

Question to advanced users, math pros/programists. Can you help me understand this explanation how to use GAM outside R? As I understand very vaguely, a matrix of parameters is being exported and ...
0
votes
0answers
62 views

Application of GAM on large dataset

I was suggested that my questions were too broad. As I commented below, I have nearly a million data points and perhaps a hundred variables. This may be a very basic modeling question: I am curious to ...
0
votes
0answers
14 views

How does one interpret r-sq (adj) versus deviance explained in GAMM creation?

I am running some models for my master's dissertation using backwards stepwise regression of GAMMs. I have six total models. I have a base model with several significant variables; the r-sq (adj) = -0....
1
vote
1answer
138 views

Model selection for GAM in R

Apologies in advance I new to this forum and to GAM models. I am trying to model complex ecological data. I have programmed a lot of GAM models using the mgcv ...
2
votes
3answers
335 views

Problems interpreting GAM output

I have been advised to run General Additive Models to be able to describe trends in my data, my data being animal harvest numbers by year. I have done so, but have a problem with interpreting the ...
3
votes
1answer
191 views

Thin Plate Regression Splines mgcv?

I am struggling on the understanding of thin plate regression splines. I already found a very helpful answer here in cross-validated: smoothing methods for gam in mgcv package but I still have some ...
8
votes
2answers
386 views

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

The following question builds on the discussion found on this page. Given a response variable y, a continuous explanatory variable ...
2
votes
1answer
98 views

My data has overdispersion but the Hurdle model estimated theta is 0. What am I doing wrong?

I am confused by the dispersion parameter from my model. My data fails the overdispersion test. It's mean is 28.7, the variance is 18655.27. N=2916 of which 32% are zeros. How can theta equal 0 in ...
0
votes
0answers
50 views

Practically speaking, what do the three concurvity measures provided by the package mgcv mean?

I am using the R package mgcv to examine the association between asthma visits to the ER and air pollution. Most of my terms are parametric, with the exception of time, which is a smooth cubic ...
3
votes
0answers
48 views

How can I incorporate a known measurement error per group into a GAM?

I am trying to investigate surface changes using a time series of 3D point clouds. Due to data volume, I am segmenting the point cloud in small (eg. 50cmx50cm) areas and for each compute a generalized ...
2
votes
1answer
174 views

Random effects in GAM

I'm modelling some biological function, outcome, in patients over 8 hours. Over time, I measure two additional covariates x and ...
1
vote
0answers
26 views

How to measure the amount of confounding in tensor interaction in GAMs?

I am interested in fitting an additive model with tensor interaction terms. This construction is described in Wood (2006) and used in the mgcv ...
0
votes
0answers
51 views

Step failure in theta estimation using bam() in mgcv

I am using ?bam in mgcv 1.8-24, and when I'm using the negative binomial family I sometimes get a warning that says: ...
0
votes
1answer
63 views

mgcv::gam(). ANOVA decomposition of a factor-by-variable interaction

Suppose: y is a continuous response variable. z is a factor variable, and x is a continuous variable. For example, ...
1
vote
1answer
154 views

Confidence Interval for non-smooth term in gam (mgcv)

I fitted a gam model in mgcv package and now want to get the confidence intervals for the non-smooth term. ...
2
votes
0answers
52 views

confidence intervals of function of predictions

I would like to know how to get confidence intervals of function of predictions of a gam (via R package mgcv) model. In detail, I got $h\left( y_i \right) = E\left(y_i\right)$ and $std\left(y_i\right)$...
1
vote
0answers
42 views

bam() error: “reparameterization unstable for margin: not done”

In running a large GAM model of the form mgcv::bam(y ~ te(x, y, k = 100, bs = 'ts'), family = binomial, discrete = TRUE) I get this warning <...
2
votes
1answer
278 views

Difference between s() and ti() terms in mgcv package when applied to one variable

I am using the mgcv package in R to fit logistic GAMs to survey data. In one of my models I use an interaction between two covariates. I am currently trying to fit ...
1
vote
0answers
39 views

gam/gamm when response variable is complex

I would like to fit a generalized additive mixed model using mgcv or gamm4, but have a response variable consisting of complex numbers where y=a+1i*b. Is this possible, and if so are there any special ...
2
votes
1answer
33 views

How to make a random draw from a mgcv GAM model

Hi there statistical wizards! I have a (maybe) minor problem, where I would like to use the predicted fit (fit) and standard error (...
1
vote
0answers
159 views

Correct way to account for repeated measures and spatial autocorrelation in GAMM (R)

I am using the gamm function in the mgcv package in R to specify a model that predicts abundance with respect to elevation and year based on repeated measures from several sites. My overarching ...
0
votes
0answers
32 views

Dealing with complete separation in Generalized Additive Models

Related to "How to deal with perfect separation in logistic regression?": I am modelling survival using a binomial mixed model (gamm from ...
1
vote
1answer
72 views

Why doesn't penalized cubic regression reduce the number of knots in a GAM?

As far as I understand, cubic regression penalization prevents overfitting by reducing the number of knots by penalizing wiggliness. The supplied parameter k serves ...
0
votes
1answer
58 views

Circular smooths within a GAM-GEE framework

I have a predictor variable which I fit in a GAM as a circular smooth term: ...
3
votes
1answer
66 views

Why p-values are not significant even though AIC values improved a lot in model selection using GAM mix modelling and beta regression

Dear StatExchange community, I am studying disease progression in plant leaves and I am trying to estimate differences between a wild-type and a mutant plant. To achieve this I am using the ...
0
votes
0answers
102 views

How to calculate pooled deviance explained from gam model fitted with multiple imputation data set?

I fitted gam model using mgcv package with multiple imputation data set. I need to calculate the combined overall deviance explained. Is the approach used in combining r-square from multiple ...
1
vote
1answer
155 views

Random effect in GAM - what are the smooth functions used?

In the GAM package in R created by Simon Wood there is a selection of the smooth function basis. I sort of understand the options such as bs='tp', bs='cr', etc. But bs='re' seems odd... that does ...
1
vote
0answers
42 views

mgcv factor smooth interaction plot [closed]

I am using mgcv with factor smooths to compare smooths of 5 Type factors. Example code is m <- gamm(Y ~ s(X,Type, bs="fs"),random=list(UnID=~1) I plot the results using plot(m) but how do I link ...
2
votes
1answer
89 views

Modeling academic seasonality with hierarchical GAMs

I am trying to model the seasonality of daily pageviews to calculus-related Wikipedia articles using a hierarchical GAM, assuming that there is a shared 'academic calendar' seasonality and that each ...
1
vote
1answer
49 views

predict.bam() produces different results when data is subset

Apologies in advance since I cannot provide a reproducible example due to the immense size of my model. I'll do my best to describe my situation fully, hopefully this will be sufficient. My model ...
1
vote
1answer
887 views

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

I have settled on building a generalized additive mixed model using mgcv::gamm, on data and for purposes I have described in more detail here. In a nutshell, I want ...
2
votes
1answer
105 views

Explaining tourist numbers over time to historic sites, based on a set of predictors

I've been struggling for some time trying to figure out the most appropriate way to analyse some data. My task is to (hopefully) explain what may be driving the flow of visitors/tourists to two ...
2
votes
1answer
86 views

Concurvity in additive modelling. Parametric term?

I am modelling a outcome in gam were two variables (x1 and x2) are continuous and the other four are factors. I have a suspicion that x1 and x2 might be collinear so I want to check that. As I ...
3
votes
1answer
78 views

Non-normal random effects in a logistic GAM

I have estimated the following GAM using the mgcv package: ...
1
vote
1answer
541 views

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

My question concerns pairwise comparisons of factor levels in a gam object. I have a dataframe, df, containing reaction time data (in ms) to stimuli varying in ...
1
vote
0answers
29 views

Difference between tensor product and main effects plus interaction in mgcv [duplicate]

I was under the impression that using te and adding the main effects with s plus the interaction with ...
3
votes
1answer
87 views

Inconsistent mgcv gam.check results

I'm not sure if this question is appropriate for cross validated, but I'm not sure where else to post it. I've built a simple model using the mgcv package. <...
1
vote
1answer
276 views

Interpretation of Tensor product splines with multiple terms and their standard errors?

I am trying to understand the tensor product splines such as ...