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

Error after Theta reset due to ID being a factor #470

Open
billdenney opened this issue Aug 20, 2024 · 1 comment
Open

Error after Theta reset due to ID being a factor #470

billdenney opened this issue Aug 20, 2024 · 1 comment

Comments

@billdenney
Copy link
Contributor

This may be related to #454

I'm fitting a model oddly while working on likelihood profiling. This did not converge (and it may never converge due to the tv value being far from the correct value), but the reason it didn't converge may be something that should be fixed where the error of "Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'." did not seem like it should be relevant.

library(nlmixr2)
#> Loading required package: nlmixr2data

mod <- function() {
  ini({
    tka <- 0.457920524576555
    tcl <- 1.01463922110082
    tv <- fix(7.42588307259747)
    add.sd <- c(0, 0.693895455003917)
    eta.ka ~ 0.406807327013617
    eta.cl ~ 0.0684420360035659
    eta.v ~ 0.019933306613011
  })
  model({
    ka <- exp(tka + eta.ka)
    cl <- exp(tcl + eta.cl)
    v <- exp(tv + eta.v)
    cp <- linCmt()
    cp ~ add(add.sd)
  })
}

nlmixr2(mod, data = theo_sd, est = "focei")
#> rxode2 2.1.3.9000 using 8 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`
#> Key: U: Unscaled Parameters; X: Back-transformed parameters; G: Gill difference gradient approximation
#> F: Forward difference gradient approximation
#> C: Central difference gradient approximation
#> M: Mixed forward and central difference gradient approximation
#> Unscaled parameters for Omegas=chol(solve(omega));
#> Diagonals are transformed, as specified by foceiControl(diagXform=)
[ deleted a bunch of lines ]
#> |  266|     622.72340 |    -1.053 |     1.706 |     8.741 |    -1.545 |
#> |.....................|   -0.9078 |     10.09 |...........|...........|
#> |    U|      622.7234 |    0.4050 |     3.215 |     3.999 |    0.2409 |
#> |.....................|     1.307 |     6.077 |...........|...........|
#> |    X|      622.7234 |     1.499 |     24.91 |     3.999 |    0.2409 |
#> |.....................|     1.307 |     6.077 |...........|...........|
#> Theta reset (ETA drift)
#> |  267|     7364.7264 |    -1.000 |   -0.4947 |   -0.7858 |   -0.2791 |
#> |.....................|    0.3589 |     1.000 |...........|...........|
#> |    U|     7364.7264 |    0.4579 |     1.015 |    0.6939 |     1.252 |
#> |.....................|     1.955 |     2.661 |...........|...........|
#> |    X|     7364.7264 |     1.581 |     2.758 |    0.6939 |     1.252 |
#> |.....................|     1.955 |     2.661 |...........|...........|
#> Error in .foceiFitInternal(.env) : Starting values violate bounds
#> Restart 1
#> Error in .foceiFitInternal(.ret) : 
#>   Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'.
#> Restart 2
#> Error in .foceiFitInternal(.ret) : 
#>   Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'.
#> Restart 3
#> Error in .foceiFitInternal(.ret) : 
#>   Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'.
#> Error : Could not fit data
#>   Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'.
#> Error: Could not fit data
#>   Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'.

Created on 2024-08-20 with reprex v2.1.1

@billdenney
Copy link
Contributor Author

billdenney commented Aug 21, 2024

I think that there may be two things happening here:

  1. Something around the reported error of Assertion on 'fitEnv$etaObj$ID' failed: Must be of type 'integer', not 'factor'. I think that error is happening here:
    checkmate::assertInteger(.ret$etaObf$ID, any.missing=FALSE, min=1, .var.name="fitEnv$etaObj$ID")
  2. A theta reset should not occur on fixed parameters.

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

1 participant