Create a data object for use in get_mcmc_posterior()
new_stan_data.Rd
Create a data object for use in get_mcmc_posterior()
Usage
new_stan_data(
regimen,
covariates,
data,
parameters,
fixed = NULL,
iiv,
ruv,
dose_cmt = 1,
ltbs = FALSE,
verbose = FALSE
)
Arguments
- regimen
Regimen object (created by
PKPDsim::new_regimen()
)- covariates
List of covariate objects created by
PKPDsim::new_covariate()
- data
Data frame with columns
t
,dv
, andcmt
- parameters
list of population parameters, e.g.
list(CL = 5, V = 50)
- fixed
optional, vector of parameters to fix and not sample.
- iiv
list of inter-individual variability for parameters. Should have exact same list elements as
parameters
, and magnitude supplied on SD scale.- ruv
magnitude of residual unexplained variability (RUV). Should be a list specifying proportional and/or additive error magnitude on standard deviation scale, e.g.
list("prop" = 0.1, "add" = 1)
. Ifltbs
is TRUE, should specify only anadd
part, which applies an additive error on the log-scale (which then becomes an approximate proportional error).- dose_cmt
Specify what dose compartment. Observation compartment in dataset is irrelevant, handled in model.
- ltbs
use log-transform-both-sides approach for observations? Default is
FALSE
.- verbose
verbosity
Examples
regimen <- PKPDsim::new_regimen(
amt = 1500,
n = 4,
times = c(0, 12, 24, 36),
type = 'infusion'
)
covariates <- list(
WT = PKPDsim::new_covariate(
value = c(150, 149.5),
times = c(0, 30),
unit = "kg"
),
CRCL = PKPDsim::new_covariate(
value = c(6.5, 6.7),
times = c(0, 12),
unit = "l/hr"
)
)
tdm_data <- data.frame(
t = c(1, 2),
dv = c(900, 800),
cmt = c(2, 2)
)
new_stan_data(
regimen,
covariates,
tdm_data,
parameters = list(CL = 5, V = 50),
iiv = list(CL = 0.1, V = 0.2),
ruv = list(prop = 0.1, add = 1)
)
#> $parameters
#> $parameters$CL
#> [1] 5
#>
#> $parameters$V
#> [1] 50
#>
#>
#> $fixed
#> NULL
#>
#> $regimen
#> t type amt t_inf
#> 1 0 infusion 1500 1
#> 2 12 infusion 1500 1
#> 3 24 infusion 1500 1
#> 4 36 infusion 1500 1
#>
#> $covariates
#> $covariates$WT
#> value times unit implementation
#> 1 150.0 0 kg interpolate
#> 2 149.5 30 kg interpolate
#>
#> $covariates$CRCL
#> value times unit implementation
#> 1 6.5 0 l/hr interpolate
#> 2 6.7 12 l/hr interpolate
#>
#>
#> $data
#> t dv cmt
#> 1 1 900 2
#> 2 2 800 2
#>
#> $iiv
#> $iiv$CL
#> [1] 0.1
#>
#> $iiv$V
#> [1] 0.2
#>
#>
#> $ruv
#> $ruv$prop
#> [1] 0.1
#>
#> $ruv$add
#> [1] 1
#>
#>
#> $stan_data
#> $stan_data$ID
#> [1] 1 1 1 1 1 1 1 1 1
#>
#> $stan_data$time
#> [1] 0 0 1 2 12 12 24 30 36
#>
#> $stan_data$cmt
#> [1] 1 2 2 2 1 2 1 2 1
#>
#> $stan_data$DV
#> [1] 0 0 900 800 0 0 0 0 0
#>
#> $stan_data$amt
#> [1] 1500 0 0 0 1500 0 1500 0 1500
#>
#> $stan_data$evid
#> [1] 1 2 0 0 1 2 1 2 1
#>
#> $stan_data$MDV
#> [1] 1 0 0 0 1 0 1 0 1
#>
#> $stan_data$rate
#> [1] 1500 0 0 0 1500 0 1500 0 1500
#>
#> $stan_data$WT
#> [1] 150.0 150.0 150.0 150.0 150.0 150.0 150.0 149.5 149.5
#>
#> $stan_data$CRCL
#> [1] 6.5 6.5 6.5 6.5 6.5 6.7 6.7 6.7 6.7
#>
#> $stan_data$addl
#> [1] 0 0 0 0 0 0 0 0 0
#>
#> $stan_data$ss
#> [1] 0 0 0 0 0 0 0 0 0
#>
#> $stan_data$ii
#> [1] 0 0 0 0 0 0 0 0 0
#>
#> $stan_data$theta_CL
#> [1] 5
#>
#> $stan_data$omega_CL
#> [1] 0.1
#>
#> $stan_data$theta_V
#> [1] 50
#>
#> $stan_data$omega_V
#> [1] 0.2
#>
#> $stan_data$dv_pk
#> [1] 900 800
#>
#> $stan_data$i_obs_pk
#> [1] 3 4
#>
#> $stan_data$n_obs_pk
#> [1] 2
#>
#> $stan_data$ruv_prop_pk
#> [1] 0.1
#>
#> $stan_data$ruv_add_pk
#> [1] 1
#>
#> $stan_data$ltbs_pk
#> [1] FALSE
#>
#> $stan_data$n_t
#> [1] 9
#>
#>