buildgam {buildmer} | R Documentation |
Use buildmer
to fit generalized additive models using gam
from package mgcv
Description
Use buildmer
to fit generalized additive models using gam
from package mgcv
Usage
buildgam(
formula,
data = NULL,
family = gaussian(),
quickstart = 0,
buildmerControl = buildmerControl()
)
Arguments
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 |
Details
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 supported, provided that they use normal formulas. Currently, this is only true of the cox.ph
family. Because this family can only be fitted using REML, buildgam
automatically sets gam
's select
argument to TRUE
and prevents removal of parametric terms.
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.
See Also
Examples
library(buildmer)
model <- buildgam(f1 ~ s(timepoint,by=following) + s(participant,by=following,bs='re') +
s(participant,timepoint,by=following,bs='fs'),data=vowels)