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

Promoting parameters from dataset values to estimated parameters works with an initial estimate but not bounds #692

Closed
billdenney opened this issue Jun 14, 2024 · 0 comments · Fixed by #694
Assignees

Comments

@billdenney
Copy link
Contributor

library(nlmixr2)
#> Loading required package: nlmixr2data

one.compartment <- function() {
  ini({
    tka <- log(1.57); label("Ka")
    tcl <- log(2.72); label("Cl")
    tv <- log(31.5); label("V")
    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)
    d/dt(depot) <- -ka * depot
    d/dt(center) <- ka * depot - cl / v * center
    cp <- center / v
    cp ~ add(add.sd)
  })
}

mod_up <-
  one.compartment |>
  model(
    extraValue <- exp(lextraValue),
    append = NA
  )

mod_up1 <-
  mod_up |>
  ini(
    lextraValue <- 2
  )
#> ℹ promote `lextraValue` to population parameter with initial estimate 2
#> ℹ change initial estimate of `lextraValue` to `2`

mod_up2 <-
  mod_up |>
  ini(
    lextraValue <- c(1, 2)
  )
#> Error in .addVariableToIniDf(.lhs, rxui, toEta = .tilde, value = .rhs, : Assertion on 'value' failed: Must have length 1, but has length 2.

mod_up3 <-
  mod_up |>
  ini(
    lextraValue <- c(1, 2, 3)
  )
#> Error in .addVariableToIniDf(.lhs, rxui, toEta = .tilde, value = .rhs, : Assertion on 'value' failed: Must have length 1, but has length 3.

Created on 2024-06-14 with reprex v2.1.0

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

Successfully merging a pull request may close this issue.

1 participant