Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mgcv]

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

2
votes
1answer
18 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
13 views

concurvity in presence of random smooths

I am trying to fit a GAMM containing per subject random smooths using the bam function in mgcv as follows: ...
0
votes
0answers
17 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
49 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
33 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
8 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
votes
0answers
24 views

Interpreting GAM Model Plot Diagnostics

I ran a gam model using the mgcv package. When i used gam.check I struggled to understand ...
1
vote
1answer
25 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
88 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 ...
1
vote
0answers
57 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
222 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
75 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
35 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
41 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 ...
1
vote
1answer
34 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
21 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
29 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
31 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
75 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
38 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
29 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
151 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 ...
0
votes
0answers
26 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 ...
1
vote
1answer
26 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 (...
0
votes
0answers
79 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
18 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
62 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
0answers
33 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
51 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
63 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
78 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
25 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
70 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
37 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 ...
0
votes
1answer
429 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
86 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
63 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
62 views

Non-normal random effects in a logistic GAM

I have estimated the following GAM using the mgcv package: ...
1
vote
1answer
176 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
18 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
61 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
168 views

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

I am trying to understand the tensor product splines such as ...
1
vote
1answer
340 views

Extracting significance of gam smoothing terms

I have a time course data to which I'd like to fit a gam and have easy interpretability, and by that I mean obtaining coefficient...
1
vote
1answer
99 views

How does Markov random field (bs=mrf) in mgvc gam handle repeated measures on the spatial units?

I am attempting a spatio-temporal model in mgcv gam. I am using a factor smooth to define each of 27 areal units in a shapefile ("id") as subjects (essentially) which have undergone 23 repeated ...
2
votes
1answer
121 views

Determining significant changes in slope in a nested GAM

I have annual measurements from 2 sites and want to plot where significant changes in slope occur in each site (in a nested design). I can achieve this using non-nested data based on Gavin Simpson's ...
0
votes
0answers
198 views

dependence structure in GAM partial residual plot {mgcv}

I am modeling daily mortality (dependent variable) against lag 1-day mean temperature (independent variable) with GAM, using the {mgcv} package in R. While looking through my data I noticed some of ...
0
votes
1answer
505 views

Choosing k in mgcv's gam()

This post (link below) alludes to setting the basis dimension to -1 (k = -1) as automatically choosing the number of knots via Generalized Cross Validation (GCV) in R's mgcv package: Selecting knots ...
5
votes
3answers
374 views

Which method is correct? (generalized additive model, mgcv)

If possible could you please let me know if I am on the right track? I don't know anyone who works with GAMs who I can ask and I would be so appreciative of any help I receive. I use mgcv in R. My ...
0
votes
1answer
34 views

Including streaks/runs in (generalized) linear mixed model context

The data and model used so far: I have longitudinal count data on 16 pens (8 with treatment A, 8 with treatment B). Each pen houses the same number of animals, and the pens may be considered as ...
1
vote
0answers
146 views

Visualizing the smooth terms in a logistic regression (GAM model)

We have a a logistic regression model (i.e. family=binomial) estimated with gam of the mgcv ...