Skip to contents

Either to include different data, or because you have upgraded ctsem and the internal data structure has changed. Works on a fit from either backend.

Usage

ctFitUpdate(oldfit, data = NA, recompile = FALSE, refit = FALSE, ...)

Arguments

oldfit

fit object to be updated, from ctFit with either backend.

data

replacement long format data object. If not supplied, the data the fit was made with.

recompile

whether to force a recompile of the Stan model – safer but slower and usually unnecessary. Stan fits only.

refit

if TRUE, refits the model using the old estimates as a starting point. Only applicable for optimized fits, not sampling. If FALSE, the old fit is returned with its data and model specification replaced; its estimates, and everything computed from them when it was fitted, are left as they were.

...

extra arguments to pass to ctFit

Value

updated fit object, of the same class as oldfit.

Details

The fit is rebuilt from its own call: the arguments it was made with are passed to ctFit again, with the model it was given and, unless data is supplied, the data it was fitted to. Arguments in ... replace the fit's own.

With refit=FALSE and data, the data are instead prepared under the model the fit ran, so the fit keeps its structure along with its estimates whatever the data – a single subject included, which ctFit would set up without random effects. To predict for other data, ctPredict(fit, newdata = data) does the same without an update.

Examples

newfit <- ctFitUpdate(ctstantestfit,refit=FALSE)