Questions tagged [mgcv]

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

mgcv is a package for the R project for statistical computing. "mgcv" stands for mixed GAM computation vehicle. Additional information can be found in the following webpages:

542 questions
9
votes
1 answer

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 for a GAM except that k is NOT the number of…
compbiostats
  • 1,557
1
vote
1 answer

Extract random effects from gamm with mgcv

Hi I've started fitting simple gams with random intercepts using mgcv and bs='re', but I can't seem to find how to extract the conditional modes/random effects/BLUPs for each level of my factor. ie the equivalent of ranef() in lmer. My googling has…
1
vote
1 answer

Plotting a difference curve involving the reference smooth

I'm wondering if there is a way to plot a difference curve for two smooths involving the intercept. Here is a summary of the model smooths. s(percent) s(percent):x1x2voiced.D s(percent):x1x2voiceless.f …
Dallak
  • 21
1
vote
0 answers

Gam.check() and k number

Hello I have a question regarding gam.check() I understand that small p-values in the output of gam.check() indicate that residuals are not randomly distributed. This often means there are not enough basis functions. However, If I try to increase…
1
vote
0 answers

mgcv factor smooth interaction plot

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 the different colours plotted to the factors.…