Closed DimitrisVoul closed 5 years ago
CPRED
is better than PRED
; CWRES
is better than WRES
, so xpose uses over other metrics even with NONMEM
.
However, if you want to use these metrics you can:
library(nlmixr)
library(xpose)
#> Loading required package: ggplot2
#>
#> Attaching package: 'xpose'
#> The following object is masked from 'package:nlmixr':
#>
#> vpc
#> The following object is masked from 'package:stats':
#>
#> filter
library(xpose.nlmixr)
#>
#> Attaching package: 'xpose.nlmixr'
#> The following object is masked from 'package:nlmixr':
#>
#> vpc
one.compartment.saem <- function() {
ini({
tka <- .5 # Log Ka
tcl <- -3.2 # Log Cl
tv <- -1 # Log V
eta.ka ~ 1
eta.cl ~ 2
eta.v ~ 1
add.err <- 0.1
})
model({
ka <- exp(tka + eta.ka)
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) = -ka * depot
d/dt(center) = ka * depot - cl / v * center
cp = center / v
cp ~ add(add.err)
})
}
fit <- nlmixr(one.compartment.saem, theo_sd, est="saem", control=list(print=500))
#> Compiling RxODE equations...
#> done.
#> 1: 0.1503 -3.3314 -0.6447 0.9500 1.9000 0.9500 9.6167
#> 500: 0.4546 -3.2153 -0.7848 0.4413 0.0713 0.0180 0.4774
#> Calculating residuals/tables
#> done.
xp <- xpose_data_nlmixr(fit,pred="PRED")
absval_res_vs_pred(xp, res="WRES")
Created on 2019-02-19 by the reprex package (v0.2.1)
The key is to specify pred
when converting nlmixr to xpose and res
when calling the specific plots.
That's great, thank you very much.
The issue is that I get some negative values with CPRED which makes the plot really difficult to interpret.
Any ideas as to why that might be the case?
Hi @DimitrisVoul
I forgot to answer you; I do not know why CPREDs may be negative in this case. I will say that CPRED is closer to what FOCEi optimizes, so it is usually a better metric.
You can also try npde
s to see how the model is performining.
f <- nlmixr(model,data,"focei",table=tableControl(npde=TRUE))
Hello,
I am fitting some data with focei and using xpose to plot the results. Is it possible to use PRED instead of CPRED which is the default choice in the xpose?
and similary WRES instead of CWRES.