Skip to contents

Assert properties of the rxUi models

Usage

assertRxUi(ui, extra = "", .var.name = .vname(ui))

assertRxUiPrediction(ui, extra = "", .var.name = .vname(ui))

assertRxUiIovNoCor(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoMix(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoAutoregressive(ui, extra = "", .var.name = .vname(ui))

assertRxUiSingleEndpoint(ui, extra = "", .var.name = .vname(ui))

assertRxUiTransformNormal(ui, extra = "", .var.name = .vname(ui))

assertRxUiNormal(ui, extra = "", .var.name = .vname(ui))

testRxUiPriors(ui, extra = "", .var.name = .vname(ui))

testRxUiNormalPriors(ui, extra = "", .var.name = .vname(ui))

testRxUiOmegaDf(ui, extra = "", .var.name = .vname(ui))

testRxUiOmegaNormalPriors(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoPriors(ui, extra = "", .var.name = .vname(ui))

assertRxUiNormalPriors(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoOmegaDf(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoOmegaNormalPriors(ui, extra = "", .var.name = .vname(ui))

assertRxUiMuRefOnly(ui, extra = "", .var.name = .vname(ui))

assertRxUiEstimatedResiduals(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoFixedResiduals(ui, extra = "", .var.name = .vname(ui))

assertRxUiNoFixedOmega(ui, extra = "", .var.name = .vname(ui))

assertRxUiTransform(ui, transform, extra = "", .var.name = .vname(ui))

assertRxUiErrType(ui, errType, extra = "", .var.name = .vname(ui))

assertRxUiAddProp(ui, addProp, extra = "", .var.name = .vname(ui))

assertRxUiPopulationOnly(ui, extra = "", .var.name = .vname(ui))

assertRxUiMixedOnly(ui, extra = "", .var.name = .vname(ui))

assertRxUiRandomOnIdOnly(ui, extra = "", .var.name = .vname(ui))

Arguments

ui

Model to check

extra

Extra text to append to the error message (like "for focei")

.var.name

[character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.

transform

character vector of the residual transformations that are allowed (the levels of ui$predDf$transform, like "untransformed", "lnorm" or "boxCox")

errType

character vector of the residual error types that are allowed ("add", "prop", "pow", "add + prop" or "add + pow")

addProp

character vector of the add() + prop() and add() + pow() combinations that are allowed ("combined1" or "combined2")

Value

the rxUi model

Details

These functions have different types of assertions

  • assertRxUi – Make sure this is a proper rxode2 model (if not throw error)

  • assertRxUiSingleEndpoint – Make sure the rxode2 model is only a single endpoint model (if not throw error)

  • assertRxUiTransformNormal – Make sure that the model residual distribution is normal or transformably normal

  • assertRxUiNormal – Make sure that the model residual distribution is normal

  • assertRxUiEstimatedResiduals – Make sure that the residual error parameters are estimated (not modeled).

  • assertRxUiNoFixedResiduals – Make sure that none of the residual error parameters are fixed (ie add.sd <- fix(0.7), a literal add(0.7), or a fixed distribution parameter like the lambda of pois(lambda)); used by estimation methods that always estimate them, so a fixed value is an error instead of being silently estimated

  • assertRxUiNoFixedOmega – Make sure that none of the between-subject variability parameters are fixed (ie eta.ka ~ fix(0.6)); used by estimation methods that always estimate them, so a fixed value is an error instead of being silently estimated

  • assertRxUiTransform – Make sure that every endpoint with a residual error (normal, or with dnorm(), dt() or dcauchy()) uses one of the transform residual transformations (like "untransformed" or "lnorm"); used by estimation methods that support only some transformations. Endpoints without a residual error (like pois() or ll()) are not checked; see assertRxUiTransformNormal

  • assertRxUiErrType – Make sure that every endpoint with a residual error uses one of the errType residual error types ("add", "prop", "pow", "add + prop", "add + pow"); used by estimation methods that support only some residual error types

  • assertRxUiAddProp – Make sure that every add() + prop() or add() + pow() residual error uses one of the addProp combinations ("combined1", where the standard deviations add, or "combined2", where the variances add); an endpoint declared without combined1() or combined2() uses rxControl(addProp=) or, when that is not set, getOption("rxode2.addProp", "combined2")

  • assertRxUiPopulationOnly – Make sure the model is the population only model (no mixed effects)

  • assertRxUiMixedOnly – Make sure the model is a mixed effect model (not a population effect, only)

  • assertRxUiPrediction – Make sure the model has predictions

  • assertRxUiMuRefOnly – Make sure that all the parameters are mu-referenced

  • assertRxUiRandomOnIdOnly – Make sure there are only random effects at the ID level

  • assertRxUiIovNoCor – Make sure that the IOV model does not have any correlations

  • assertRxUiNoMix – Make sure that the model does not have a mixture model inside it

  • assertRxUiNoAutoregressive – Make sure the model does not have an autoregressive residual (ie ar()); used by estimation methods that do not support it

  • assertRxUiNoPriors – Make sure the model does not specify any prior distributions; used by estimation methods that cannot use them, so that a specified prior is an error instead of being silently ignored

  • assertRxUiNormalPriors – Make sure that every prior the model specifies is a normal prior (dnorm(), stdNormal(), or the multivariate multiNormal() that the lotri normal prior shorthand produces for correlated parameters); used by estimation methods that support priors but only normal ones

  • assertRxUiNoOmegaDf – Make sure the model does not give prior degrees of freedom for an omega block (ie invWishart(4), the $OMEGAPD of a NONMEM NWPRI model); used by estimation methods that cannot use them

  • assertRxUiNoOmegaNormalPriors – Make sure the model does not put a normal prior on an omega parameter (ie om.eta.cl ~ 0.01, what a NONMEM TNPRI model needs); used by estimation methods that can put a prior on an omega but only a Wishart one

Author

Matthew L. Fidler

Examples


# \donttest{
one.cmt <- function() {
 ini({
   tka <- 0.45; label("Ka")
   tcl <- log(c(0, 2.7, 100)); label("Cl")
   tv <- 3.45; label("V")
   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)
   linCmt() ~ add(add.sd)
 })
}

assertRxUi(one.cmt)
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
# assertRxUi(rnorm) # will fail

assertRxUiSingleEndpoint(one.cmt)
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments

assertRxUiNoFixedResiduals(one.cmt)
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments

assertRxUiNoFixedOmega(one.cmt)
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments

assertRxUiTransform(one.cmt, c("untransformed", "lnorm"))
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments

assertRxUiErrType(one.cmt, c("add", "prop", "add + prop"))
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments

assertRxUiAddProp(one.cmt, "combined2")
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
# }