
Estimate the posterior distribution of individual parameters by SIR
Source:R/param_estim.R
poso_estim_sir.Rd
Estimates the posterior distribution of individual parameters by Sequential Importance Resampling (SIR)
Usage
poso_estim_sir(
dat = NULL,
prior_model = NULL,
n_sample = 10000,
n_resample = 1000,
return_model = TRUE,
nocb = FALSE
)
Arguments
- dat
Dataframe. An individual subject dataset following the structure of NONMEM/rxode2 event records.
- prior_model
A
posologyr
prior population pharmacokinetics model, a list of six objects.- n_sample
Number of samples from the S-step
- n_resample
Number of samples from the R-step
- return_model
A boolean. Returns a rxode2 model using the estimated ETAs if set to
TRUE
.- nocb
A boolean. for time-varying covariates: the next observation carried backward (nocb) interpolation style, similar to NONMEM. If
FALSE
, the last observation carried forward (locf) style will be used. Defaults toFALSE
.
Value
If return_model
is set to FALSE
, a list of one element: a
dataframe $eta
of ETAs from the posterior distribution, estimated by
Sequential Importance Resampling.
If return_model
is set to TRUE
, a list of the dataframe of the posterior
distribution of ETA, and a rxode2 model using the estimated distributions of
ETAs.
Examples
# model
mod_run001 <- function() {
ini({
THETA_Cl <- 4.0
THETA_Vc <- 70.0
THETA_Ka <- 1.0
ETA_Cl ~ 0.2
ETA_Vc ~ 0.2
ETA_Ka ~ 0.2
prop.sd <- sqrt(0.05)
})
model({
TVCl <- THETA_Cl
TVVc <- THETA_Vc
TVKa <- THETA_Ka
Cl <- TVCl*exp(ETA_Cl)
Vc <- TVVc*exp(ETA_Vc)
Ka <- TVKa*exp(ETA_Ka)
K20 <- Cl/Vc
Cc <- centr/Vc
d/dt(depot) = -Ka*depot
d/dt(centr) = Ka*depot - K20*centr
Cc ~ prop(prop.sd)
})
}
# df_patient01: event table for Patient01, following a 30 minutes intravenous
# infusion
df_patient01 <- data.frame(ID=1,
TIME=c(0.0,1.0,14.0),
DV=c(NA,25.0,5.5),
AMT=c(2000,0,0),
EVID=c(1,0,0),
DUR=c(0.5,NA,NA))
# estimate the posterior distribution of population parameters
poso_estim_sir(dat=df_patient01,prior_model=mod_run001,
n_sample=1e3,n_resample=1e2)
#>
#>
#> Error : cannot convert to rxUi object
#>
#>
#> Error : cannot convert to rxUi object
#> Error in priormod$ppk_model: object of type 'closure' is not subsettable