Learn R Programming

xpose.xtras (version 0.1.2)

nlmixr2_m3: An xp_xtra example based on a nlmixr2 fit with M3 censoring

Description

A modified version of the theophylline model fit with censoring added in to provoke M3 censoring. An additional output variable is added to use an an example in categorical DVs.

Usage

nlmixr2_m3

Arguments

Format

An object of class xp_xtras (inherits from xpose_data, uneval) of length 10.

See Also

xpdb_nlmixr2 catdv_vs_dvprobs()

Examples

Run this code
if (FALSE) {
# This not-run block is to show how the dataset was generated
# This is also available in data-raw of the github repo
one.cmt <- function() {
  ini({
    ## You may label each parameter with a comment
    tka <- 0.45 # Ka
    tcl <- log(c(0, 2.7, 100)) # Log Cl
    ## This works with interactive models
    ## You may also label the preceding line with label("label text")
    tv <- 3.45; label("log V")
    ## the label("Label name") works with all models
    eta.ka ~ 0.6
    eta.cl ~ 0.3
    eta.v ~ 0.1
    add.sd <- 0.7
  })
  model({
    ka <- exp(tka + eta.ka)
    cl <- exp(tcl + eta.cl)
    v <- exp(tv + eta.v)
    # Not sure how one does this with linCmt(), if that has to be posthoc
    d/dt(depot) = -ka*depot
    d/dt(cent) = ka*depot - cl*cent/v
    cp = cent/v
    blqlike = pnorm( (LLOQ - cp)/add.sd  ) # blq likelihood for diagnostics
    cp ~ add(add.sd)
  })
}
theo_sdcens=nlmixr2data::theo_sd
good_lloq <- quantile(theo_sdcens[theo_sdcens$EVID==0,]$DV, 0.15)
theo_sdcens$CENS=ifelse(theo_sdcens$DV% # modified from catdv_vs_dvprobs example
  set_var_types(catdv=CENS,dvprobs=BLQLIKE) %>%
  set_dv_probs(1, 1~BLQLIKE, .dv_var = CENS) %>%
  set_var_levels(1, CENS = lvl_bin()) %>%
  catdv_vs_dvprobs(xlab = "basic", quiet = TRUE)

Run the code above in your browser using DataLab