Skip to contents

Add table information to nlmixr2 fit object without tables

Usage

addTable(
  object,
  updateObject = FALSE,
  data = object$dataSav,
  thetaEtaParameters = object$foceiThetaEtaParameters,
  table = tableControl(),
  keep = NULL,
  drop = NULL,
  envir = parent.frame(1)
)

Arguments

object

nlmixr2 family of objects

updateObject

Update the object (default FALSE)

data

Saved data from

thetaEtaParameters

Internal theta/eta parameters

table

a `tableControl()` list of options

keep

Character Vector of items to keep

drop

Character Vector of items to drop or NULL

envir

Environment to search for updating

Value

Fit with table information attached

Author

Matthew Fidler

Examples

# \donttest{

one.cmt <- function() {
  ini({
    ## You may label each parameter with a comment
    tka <- 0.45 # Log 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)
    linCmt() ~ add(add.sd)
  })
}

# run without tables step
f <- nlmixr2(one.cmt, theo_sd, "saem", control=list(calcTables=FALSE))
#>  
#>  
#>  
#>  
#>  parameter labels from comments will be replaced by 'label()'
#>  
#>  
#> → loading into symengine environment...
#> → pruning branches (`if`/`else`) of saem model...
#>  done
#> → finding duplicate expressions in saem model...
#>  done
#> params:	tka	tcl	tv	V(eta.ka)	V(eta.cl)	V(eta.v)	add.sd
#> Calculating covariance matrix
#> → loading into symengine environment...
#> → pruning branches (`if`/`else`) of saem model...
#>  done
#> → finding duplicate expressions in saem predOnly model 0...
#> → finding duplicate expressions in saem predOnly model 1...
#> → finding duplicate expressions in saem predOnly model 2...
#>  done
#>  
#>  
#> → compress origData in nlmixr2 object, save 5952
#> → compress phiM in nlmixr2 object, save 63664
#> → compress parHist in nlmixr2 object, save 9544
#> → compress saem0 in nlmixr2 object, save 30680

print(f)
#> ── nlmix SAEM OBJF by FOCEi approximation ──
#> 
#>  Gaussian/Laplacian Likelihoods: AIC() or $objf etc. 
#>  FOCEi CWRES & Likelihoods: addCwres() 
#> 
#> ── Time (sec $time): ──
#> 
#>            setup covariance  saem compress    other
#> elapsed 0.001569   0.006006 1.123    0.026 1.648425
#> 
#> ── Population Parameters ($parFixed or $parFixedDf): ──
#> 
#>        Parameter  Est.     SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)%
#> tka       Log Ka 0.453  0.195 43.1       1.57 (1.07, 2.31)     71.4    -0.445% 
#> tcl       Log Cl  1.02 0.0843 8.29       2.76 (2.34, 3.26)     27.2      3.88% 
#> tv         log V  3.45 0.0467 1.35       31.5 (28.8, 34.5)     13.9      10.2% 
#> add.sd           0.695                               0.695                     
#>  
#>   Covariance Type ($covMethod): linFim
#>   No correlations in between subject variability (BSV) matrix
#>   Full BSV covariance ($omega) or correlation ($omegaR; diagonals=SDs) 
#>   Distribution stats (mean/skewness/kurtosis/p-value) available in $shrink 
#>   Censoring ($censInformation): No censoring

# Now add the tables

f <- addTable(f)
#> → Calculating residuals/tables
#>  done

print(f)
#> ── nlmix SAEM OBJF by FOCEi approximation ──
#> 
#>  Gaussian/Laplacian Likelihoods: AIC() or $objf etc. 
#>  FOCEi CWRES & Likelihoods: addCwres() 
#> 
#> ── Time (sec $time): ──
#> 
#>            setup covariance  saem compress    other
#> elapsed 0.001569   0.006006 1.123    0.026 1.648425
#> 
#> ── Population Parameters ($parFixed or $parFixedDf): ──
#> 
#>        Parameter  Est.     SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)%
#> tka       Log Ka 0.453  0.195 43.1       1.57 (1.07, 2.31)     71.4    -0.445% 
#> tcl       Log Cl  1.02 0.0843 8.29       2.76 (2.34, 3.26)     27.2      3.88% 
#> tv         log V  3.45 0.0467 1.35       31.5 (28.8, 34.5)     13.9      10.2% 
#> add.sd           0.695                               0.695                     
#>  
#>   Covariance Type ($covMethod): linFim
#>   No correlations in between subject variability (BSV) matrix
#>   Full BSV covariance ($omega) or correlation ($omegaR; diagonals=SDs) 
#>   Distribution stats (mean/skewness/kurtosis/p-value) available in $shrink 
#>   Censoring ($censInformation): No censoring
#> 
#> ── Fit Data (object is a modified tibble): ──
#> # A tibble: 132 × 16
#>   ID     TIME    DV  PRED    RES IPRED   IRES  IWRES eta.ka eta.cl   eta.v    ka
#>   <fct> <dbl> <dbl> <dbl>  <dbl> <dbl>  <dbl>  <dbl>  <dbl>  <dbl>   <dbl> <dbl>
#> 1 1      0     0.74  0     0.74   0     0.74   1.07   0.107 -0.485 -0.0809  1.75
#> 2 1      0.25  2.84  3.26 -0.424  3.87 -1.03  -1.49   0.107 -0.485 -0.0809  1.75
#> 3 1      0.57  6.57  5.84  0.726  6.82 -0.250 -0.360  0.107 -0.485 -0.0809  1.75
#> # ℹ 129 more rows
#> # ℹ 4 more variables: cl <dbl>, v <dbl>, tad <dbl>, dosenum <dbl>

# }