copy: Replication of an existing 'PMXStanModel' object

View source: R/PMXStanModel.R

copyR Documentation

Replication of an existing PMXStanModel object

Description

Makes a copy of an existing PMXStanModel object into a new path.

Usage

copy(model, newpath = NULL, compile = FALSE)

Arguments

model

a PMXStanModel object.

newpath

a string for user to specify the path to store the new model object. If not provided, the new path will be named by adding a suffix "_copy" to the path of the model being copied.

compile

a logical variable indicating whether to compile the Stan code in the new PMXStanModel object during the initialization process (TRUE) or not (FALSE, as default).

Details

The copy() function for a PMXStanModel object aims to provide a convenient way for the following scenarios:

- Fitting the same model to different datasets. With each copy of the model, a new input dataset can be used for generating samples, and each will result in a PMXStanFit objects. These results can then be compared and summarized.

- An exploratory, stage-wise modeling exercise, commonly used when current knowledge is not sufficient to choose among options through the model building process. One can start from a copy of the same "parent" version of the model, make specific changes one at a time, and later make a choice based on certain criteria to compare different fittings.

Value

A replicated version of the specified existing PMXStanModel object.

Author(s)

Yuan Xiong and Wenping Wang

See Also

PMXStanModel for the creation of a new PMXStanModel object.

Examples

## Not run: 
m1 <- PMXStanModel(path = tempfile("pk_m1"))
m2 <- copy(m1, newpath = "pk_m2", compile = TRUE)

## End(Not run)

stanette documentation built on May 11, 2022, 5:11 p.m.

Related to copy in stanette...