Skip to content

Error when fitting negative binomial model #6

Description

@billdenney

In the model below, I'm getting an error about the precision parameter, but I don't think I'm setting anything to -2147483648.

library(nlmixr2)
#> Loading required package: nlmixr2data

model_nb_linear_nlmixr <- function() {
  ini({
    ln0 <- log(3)
    sln <- -0.13
    lnbsize <- log(1.1)
  })
  model({
    nest <- exp(ln0 + sln*conc)
    nbsize <- exp(lnbsize)
    voc ~ dnbinomMu(nbsize, nest)
  })
}

d_model <-
  data.frame(
    ID = 0:9,
    TIME = 0:9,
    DV = rep(0:4, each = 2),
    conc = rep(0:4, each = 2)*exp(rnorm(10, mean = 0, sd = 0.1))
  )

nlmixr(object = model_nb_linear_nlmixr, data = d_model, est = "focei")
#> rxode2 2.0.13.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=)
#> |-----+---------------+-----------+-----------+-----------|
#> |    #| Objective Fun |       ln0 |       sln |   lnbsize |
#> |-----+---------------+-----------+-----------+-----------|
#> |    1|     198.74686 |     1.000 |    -1.000 |   -0.6332 |
#> |    U|     198.74686 |     1.099 |   -0.1300 |   0.09531 |
#> |    X|     198.74686 |     3.000 |   -0.1300 |     1.100 |
#> Error in .foceiFitInternal(.env) : 
#>   neg_binomial_2_lpmf: Precision parameter is -2147483648, but must be positive finite!
#> Restart 1
#> Error : focei$rxInv needs to be of class'rxSymInvCholEnv'
#> Error: focei$rxInv needs to be of class'rxSymInvCholEnv'

Created on 2023-08-29 with reprex v2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions