Carry out one or more independent smoothing-splines mixed-effects model fits simultaneously
# S3 method for data.frame
sme(object,tme,ind,verbose=F,lambda.mu=NULL,lambda.v=NULL,maxIter=500,
knots=NULL,zeroIntercept=F,deltaEM=1e-3,deltaNM=1e-3,criteria="AICc",
initial.lambda.mu=10000,initial.lambda.v=10000,normalizeTime=FALSE,…)
a data.frame
with named variables y
, tme
, ind
and,
optionally, variable
. The first three represent observations, corresponding time points and
correpsonding subjects respectively. If variable
is missing then these are used to carry
out a single model fit. If variable
is present then it denotes variable membership, and a
separate smoothing-splines mixed-effects model is fit to each unique variable
for consistency with the generic function. Ignored in this case
for consistency with the generic function. Ignored in this case
if TRUE
, debug information will be output while fitting the model(s)
in the case of carrying out a single model fit, either a smoothing parameter to
be used for the fixed-effect function or NULL
if the optimal values for this and
lambda.v
should be found according to criteria
using Nelder-Mead search. For the
case of multiple model fits, either a single smoothing parameter to be used for all fits, or a
vector of smoothing parameters, one for each fit, or NULL
if Nelder-Mead search should be
used to find the optimal values for this and lambda.v
for all variables
in the case of carrying out a single model fit, either a smoothing parameter to
be used for the random-effects functions or NULL
if the optimal values for this and
lambda.mu
should be found according to criteria
using Nelder-Mead search. For the
case of multiple model fits, either a single smoothing parameter to be used for all fits, or a
vector of smoothing parameters, one for each fit, or NULL
if Nelder-Mead search should be
used to find the optimal values for this and lambda.mu
for all variables
maximum number of iterations to be performed for the EM algorithm
location of spline knots. If NULL
, an incidence matrix representation will be
used. See `Details'
experimental feature. If TRUE
, the fitted values of the fixed- and
random-effects functions at the intercept will be zero
convergence tolerance for the EM algorithm
(relative) convergence tolerance for the Nelder-Mead optimisation
one of "AICc"
, "AIC"
, "BICN"
or "BICn"
indicating
which criteria to use to score a particular combination of lambda.mu
and lambda.v
in
the Nelder-Mead search
value to initialise the smoothing parameter for the fixed-effects to in the Nelder-Mead search. See details below
value to initialise the smoothing parameter for the random-effects to in the Nelder-Mead search. See details below
should time be normalized to lie in $[0,1]$? See details below
additional arguments used when carrying out multiple fits, specifically
numberOfThreads
indicating the number of threads used to carry out the multiple fits in
parallel. See sme.list
for details
In the case of a single model fit, an object of class sme
. For multiple model fits, a list
of such objects. See smeObject
for the components of the fit and plot.sme
for
visualisation options
Prior to package version 0.9, starting values for the smoothing parameters in the Nelder-Mead search
were fixed to $10000$ for both lambda.mu
and lambda.v
. As it turns out, the
appropriate scale for the smoothing parameters depends on the scale for tme
and so tme
will now automatically be rescaled to lie in $[0,1]$ and much smaller initial values for the
smoothing parameters will be used, although these can now optionally changed to achieve best
results. To reproduce results obtained using previous versions of the package, set
initial.lambda.mu=10000
, initial.lambda.v=10000
and normalizeTime=FALSE
.
The default behaviour is to use an incidence matrix representation for the smoothing-splines. This
works well in most situations but may incur a high computational cost when the number of distinct
time points is large, as may be the case for irregularly sampled data. Alternatively, a basis
projection can be used by giving a vector of knots
of length (much) less than the number of
distinct time points.
Berk, M. (2012). Smoothing-splines Mixed-effects Models in R. Preprint
# NOT RUN {
# }
# NOT RUN {
data(MTB)
# }
# NOT RUN {
# }
# NOT RUN {
system.time(fits <- sme(MTB,numberOfThreads=1))
# }
# NOT RUN {
# }
# NOT RUN {
sapply(fits,logLik)
# }
# NOT RUN {
# }
# NOT RUN {
system.time(fits <- sme(MTB,numberOfThreads=10))
# }
# NOT RUN {
# }
# NOT RUN {
sapply(fits,logLik)
# }
Run the code above in your browser using DataLab