Skip to content

issue with transit compart model #970

@lirui0321

Description

@lirui0321

Hi Matt,

If transit compartment is model with your approach #1, then dosing into another compartment will not work. However, if I use build-in transit function, I can dose into a different compartment. Here is what I mean.

This does not work

mod <- function() {
  model({
    ## Table 3 from Savic 2007
    cl = 17.2 # (L/hr)
    vc = 45.1 # L
    ka = 0.38 # 1/hr
    mtt = 0.37 # hr
    bio=1
    n = 20.1
    k = cl/vc
    ktr = (n+1)/mtt
    ## note that lgammafn is the same as lgamma in R.
    d/dt(depot) = exp(log(bio*podo(depot))+log(ktr)+n*log(ktr*tad(depot))-
                        ktr*tad(depot)-lgammafn(n+1))-ka*depot
    d/dt(cen) = ka*depot-k*cen
  })
}

et <- et(0, 7, length.out=200) %>%
  et(amt=20, time=0, cmt=2, evid=1)

transit <- rxSolve(mod, et)

This works

mod <- function() {
  ini({
    ## Table 3 from Savic 2007
    cl  <- 17.2 # (L/hr)
    vc  <- 45.1 # L
    ka  <- 0.38 # 1/hr
    mtt <- 0.37 # hr
    bio <- 1
    n   <- 20.1
  })
  model({
    k           <- cl/vc
    ktr         <- (n+1)/mtt
    d/dt(depot) <- transit(n,mtt,bio)-ka*depot
    d/dt(cen)   <- ka*depot-k*cen
  })
}

et <- et(0, 7, length.out=200) %>%
  et(amt=20, time=0, cmt=2, evid=1)

transit <- rxSolve(mod, et)

I am assuming these two models are the same. Why one allows me to dose into central compartment, but another does not?

BTW, does the input n for function transit(n,mtt,bio) need to be an integer, or is any positive number fine?

Thanks!

Rui

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