Closed jfstanding closed 1 year ago
I am having trouble creating a VPC for the continuous part of a censored fit. Here is an example:
library(nlmixr2) library(ggplot2) # create theo censored theo_cens <- theo_sd theo_cens$cens <- 0 theo_cens$cens[theo_cens$DV <= 1] <- 1 theo_cens$DV[theo_cens$DV <= 1 & theo_cens$AMT == 0] <- 1 m1 <- function() { ini({ tka <- 0.5 tcl <- -3.2 tv <- -1 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) linCmt() ~ add(add.err) }) } fit1 <- nlmixr(m1, theo_cens, est = "focei", table = tableControl(npde = TRUE, censMethod = "cdf")) vpcPlot(fit = fit1) # fails #> Error in `dplyr::summarise()`: #>! Problem while computing `obs5 = quantile_cens(dv, pi[1], limit = limit, cens = cens)`. #>ℹ The error occurred in group 1: strat = 1, bin = 1. #> Caused by error in `if (cens %in% c("left", "lower", "bloq", "loq", "lloq")) ...`: #> ! the condition has length > 1 #> Run `rlang::last_error()` to see where the error occurred. # # Note: # vpcPlot(fit = fit1, lloq = 1) # fit1$dataLloq # Correctly identifies lloq # vpcPlot(fit = fit1, cens = TRUE) # works for the censored part
The censored VPC cens = TRUE works but the continuous part does not.
cens = TRUE
Thanks for reporting this @jfstanding
This bug has been fixed. You can probably see the fix by installing nlmixr2plot as follows:
nlmixr2plot
devtools::install_github("nlmixr2/nlmixr2plot")
I am having trouble creating a VPC for the continuous part of a censored fit. Here is an example:
The censored VPC
cens = TRUE
works but the continuous part does not.