| buildgam | R Documentation |
buildmer to fit generalized additive models using gam from package mgcvUses buildmer to fit generalized additive models using gam from package mgcv
buildgam(
formula,
data = NULL,
family = gaussian(),
quickstart = 0,
buildmerControl = buildmerControl()
)
formula |
See the general documentation under |
data |
See the general documentation under |
family |
See the general documentation under |
quickstart |
A numeric with values from 0 to 5. If set to 1, will use |
buildmerControl |
Control arguments for buildmer — see the general documentation under |
To work around an issue in gam, you must make sure that your data do not contain a variable named 'intercept'.
lme4 random effects are supported: they will be automatically converted using re2mgcv.
If gam's optimizer argument is not set to use outer iteration, gam fits using PQL. In this scenario, only crit='F' and crit='deviance' (note that the latter is not a formal test) are legitimate in the generalized case.
General families implemented in mgcv are not supported, as they are only defined in terms of a mean-variance relationship and hence always use a linearized (PQL) approximation of the model. They do not have a real likelihood.
buildmerControl's quickstart function may be used here. If you desire more control (e.g.\ discrete=FALSE but use.chol=TRUE), additional options can be provided as extra arguments and will be passed on to bam as they are applicable. Note that quickstart needs to be larger than 0 to trigger the quickstart path at all.
If scaled-t errors are used (family=scat), the quickstart path will also provide initial values for the two theta parameters (corresponding to the degrees of freedom and the scale parameter), but only if your installation of package mgcv is at least at version 1.8-32.
buildmerControl
library(buildmer)
model <- buildgam(f1 ~ s(timepoint,by=following) + s(participant,by=following,bs='re') +
s(participant,timepoint,by=following,bs='fs'),data=vowels)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.