Learn R Programming

stanette (version 2.21.4)

copy: 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).

Value

A replicated version of the specified existing PMXStanModel object.

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.

See Also

PMXStanModel for the creation of a new PMXStanModel object.

Examples

Run this code
# NOT RUN {
m1 <- PMXStanModel(path = tempfile("pk_m1"))
m2 <- copy(m1, newpath = "pk_m2", compile = TRUE)
# }

Run the code above in your browser using DataLab