Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nlmixr2 vpc not working correctly #229

Closed
mattfidler opened this issue May 20, 2022 · 4 comments
Closed

nlmixr2 vpc not working correctly #229

mattfidler opened this issue May 20, 2022 · 4 comments
Assignees

Comments

@mattfidler
Copy link
Collaborator

mattfidler commented May 20, 2022

  library(nlmixr2)
#> Loading required package: nlmixr2data

  library(ggPMX)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2

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

  fit <- nlmixr2::nlmixr2(one.cmt, nlmixr2data::theo_sd, est="saem", control=list(print=0))
#> ℹ 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...
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00
#> ✔ done
#> rxode2 2.0.7 using 4 threads (see ?getRxThreads)
#> Calculating covariance matrix
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00
#> → loading into symengine environment...
#> → pruning branches (`if`/`else`) of saem model...
#> ✔ done
#> → finding duplicate expressions in saem predOnly model 0...
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00
#> → finding duplicate expressions in saem predOnly model 1...
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00
#> → finding duplicate expressions in saem predOnly model 2...
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00
#> ✔ done
#> → Calculating residuals/tables
#> ✔ done
#> → compress origData in nlmixr2 object, save 5952
#> → compress phiM in nlmixr2 object, save 62352
#> → compress parHist in nlmixr2 object, save 9640
#> → compress saem0 in nlmixr2 object, save 24520

  ctr <- pmx_nlmixr(fit, ## VPC is turned on by default, can turn off
                    settings = pmx_settings(is.draft = FALSE))
#> → Add NPDE
#> ✔ done
#> Calculating -2LL by Gaussian quadrature (nnodes=3,nsd=1.6)
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00

  ctr %>% pmx_plot_vpc

  vpcPlot(fit)

  ct <- theophylline()

  ct %>% pmx_plot_vpc

Created on 2022-05-21 by the reprex package (v2.0.1)

@mattfidler
Copy link
Collaborator Author

mattfidler commented May 22, 2022

The default theo example works well, but nlmixr2 output looks wrong.

@mattfidler
Copy link
Collaborator Author

  library(nlmixr)

  library(ggPMX)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2

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

  fit <- nlmixr::nlmixr(one.cmt, nlmixr2data::theo_sd, est="saem", control=list(print=0))
#> ℹ parameter labels from comments will be replaced by 'label()'
#> → generate SAEM model
#> ✔ done
#> RxODE 1.1.5 using 4 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`
#> Calculating covariance matrix
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00
#> → creating full model...
#> → pruning branches (`if`/`else`)...
#> ✔ done
#> → loading into symengine environment...
#> ✔ done
#> → compiling EBE model...
#> ✔ done
#> Calculating residuals/tables
#> done

  ctr <- pmx_nlmixr(fit, ## VPC is turned on by default, can turn off
                    settings = pmx_settings(is.draft = FALSE))
#> add npde
#> Compiling NPDE model...done
#> done
#> Compiling model...done
#> Compiling VPC model...done
#> done (0.52 sec)
#> Calculating -2LL by Gaussian quadrature (nnodes=3,nsd=1.6)
#> [====|====|====|====|====|====|====|====|====|====] 0:00:00

  ctr %>% pmx_plot_vpc

  vpcPlot(fit)
#> Error in vpcPlot(fit): could not find function "vpcPlot"

  ct <- theophylline()

  ct %>% pmx_plot_vpc

Created on 2022-05-21 by the reprex package (v2.0.1)

It doesn't work correctly with nlmixr either

@mattfidler
Copy link
Collaborator Author

I am stumped here, maybe drop it @biethbr1 @baltcir1 what do you think?

@mattfidler
Copy link
Collaborator Author

For now drop it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants