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

ini(diag()) doesn't work (though ini(diag) does) #783

Merged
merged 1 commit into from
Sep 8, 2024
Merged

Conversation

mattfidler
Copy link
Member

  library(rxode2)
#> rxode2 3.0.0 using 8 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`
  mod <- function() {
    ini({
      lka ~ 0.45
      lcl ~ c(0.01, 1)
      lvc ~ c(-0.01, 0.01, 3.45)
    })
    model({
      ka <- exp(lka)
      cl <- exp(lcl)
      vc  <- exp(lvc)
      kel <- cl / vc
      d/dt(depot) <- -ka*depot
      d/dt(central) <- ka*depot-kel*central
      cp <- central / vc
    })
  }


  mod %>% ini(diag)
#> ℹ remove covariance `(lka,lcl)`
#> ℹ remove covariance `(lka,lvc)`
#> ℹ remove covariance `(lcl,lvc)`
#>  ── rxode2-based free-form 2-cmt ODE model ──────────────────────────────────────
#>  ── Initalization: ──
#>
#> Omega ($omega):
#>      lka lcl  lvc
#> lka 0.45   0 0.00
#> lcl 0.00   1 0.00
#> lvc 0.00   0 3.45
#>
#> States ($state or $stateDf):
#>   Compartment Number Compartment Name
#> 1                  1            depot
#> 2                  2          central
#>  ── Model (Normalized Syntax): ──
#> function() {
#>     ini({
#>         lka ~ 0.45
#>         lcl ~ 1
#>         lvc ~ 3.45
#>     })
#>     model({
#>         ka <- exp(lka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         d/dt(depot) <- -ka * depot
#>         d/dt(central) <- ka * depot - kel * central
#>         cp <- central/vc
#>     })
#> }


  mod %>% ini(diag())
#> Error: vectors and list need to be named numeric expression

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

@mattfidler mattfidler merged commit 2edc22b into main Sep 8, 2024
5 of 7 checks passed
@mattfidler mattfidler deleted the 782-diag-fun branch September 8, 2024 13:55
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 this pull request may close these issues.

1 participant