Skip to content

iov simulation #982

@mattfidler

Description

@mattfidler

IOV doesn't simulate correctly yet in rxode2

library(rxode2)
#> rxode2 5.0.1.9000 using 11 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`
two.compartment.tacro.test.Polimorf <- function() {
  ini({
    ### Umpierrez_etal_model
    #### FIXED PARAMETERS
    tka <- log(2.49); label("Ka")
    tcl <- log(19.84); label("Cl")
    tvc <- log(330.4) ; label("Vc")
    tvp <- log(118.2) ; label ("Vp")
    tvq <- log(35.44); label ("Q")
    ### VARIABILITY
    eta.ka ~ 0.82 ; label("IIV Ka")
    eta.cl ~ 0.358 ;label("IIV Cl")
    eta.vc ~ 1.186  ;label("IIV Vc")
    eta.q  ~ 0.58  ;label("IIV q")
    iov.cl ~ 0.25^2 | occ
    prop.sd <- 0.204
  })
  model({
    cl <- exp(tcl+ eta.cl + iov.cl)
    ka <- exp(tka + eta.ka)
    vc <- exp(tvc + eta.vc)
    vp <- exp(tvp)
    q <- exp(tvq + eta.q)
    d/dt(depot) <- -ka * depot
    d/dt(center) <- ka * depot - cl / vc * center
    d/dt(periph) <- q / vc * depot  - q/vp * periph
    cp <- center / vc
    cp ~ prop(prop.sd)
  })
}

ev <- et(amt=1000, ii=24, addl=6) |>
    et(seq(0, 24, by=.5)) |>
    et(seq(0, 24, by=.5) + 24*3) |>
    et(seq(0, 24, by=.5) + 24*6) |>
    et(id=1:8)

ev <- as.data.frame(ev)
ev$occ <- 1
ev$occ[ev$time > 25] <- 2
ev$occ[ev$time > 24*5+1] <- 3

rxSolve(two.compartment.tacro.test.Polimorf, ev)
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> Model:
#>
#> param(tka,tcl,tvc,tvp,tvq,prop.sd,eta.ka,eta.cl,eta.vc,eta.q,iov.cl);
#> cl=exp(tcl+eta.cl+iov.cl);
#> ka=exp(tka+eta.ka);
#> vc=exp(tvc+eta.vc);
#> vp=exp(tvp);
#> q=exp(tvq+eta.q);
#> d/dt(depot)=-ka*depot;
#> d/dt(center)=ka*depot-cl/vc*center;
#> d/dt(periph)=q/vc*depot-q/vp*periph;
#> cp=center/vc;
#> rx_yj_~2;
#> rx_lambda_~1;
#> rx_low_~0;
#> rx_hi_~1;
#> rx_pred_f_~cp;
#> rx_pred_~rx_pred_f_;
#> rx_r_~(rx_pred_f_*prop.sd)^2;
#> ipredSim=rxTBSi(rx_pred_,rx_lambda_,rx_yj_,rx_low_,rx_hi_);
#> sim=rxTBSi(rx_pred_+sqrt(rx_r_)*rxerr.cp,rx_lambda_,rx_yj_,rx_low_,rx_hi_);
#> cmt(cp);
#> dvid(4);
#> Error in `rxSolveSEXP()`:
#> ! The following parameter(s) are required for solving: iov.cl, eta.q, eta.vc, eta.cl, eta.ka

Created on 2026-01-25 with reprex v2.1.1

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