library(mrgsolve)
library(magrittr)
# Define a model. Adding variability to house model because default is 0.
mod <- house() %>%
omat(dmat(rep(0.2,4)))
# Creating dataset for the example
# Same concentration, but different dose (ID 2) and covariate (ID 3)
data <- adm_rows(ID = 1, amt = 1000, cmt = 1, addl = 6, ii = 12) %>%
obs_rows(DV = 50, cmt = 2, time = 7 * 12) %>%
adm_rows(ID = 2, time = 0, amt = 2000, cmt = 1, addl = 6, ii = 12) %>%
obs_rows(DV = 50, cmt = 2, time = 7 * 12) %>%
adm_rows(ID = 3, time = 0, amt = 1000, cmt = 1, addl = 6, ii = 12) %>%
obs_rows(DV = 50, cmt = 2, time = 7 * 12) %>%
add_covariates(SEX = c(0,0,0,0,1,1))
mapbayr_vpc(mod, data, nrep = 30) # prediction-corrected by default
mapbayr_vpc(mod, data, idv = "tad", start = 72, nrep = 30)
mapbayr_vpc(mod, data, pcvpc = FALSE, nrep = 30)
mapbayr_vpc(mod, data, stratify_on = "SEX", nrep = 30)
Run the code above in your browser using DataLab