You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This is an example to simulate and estimate dual first order# and zero order absorption
library(nlmixr2)
#> Warning: package 'nlmixr2' was built under R version 4.3.3#> Loading required package: nlmixr2data#> Warning: package 'nlmixr2data' was built under R version 4.3.3
library(rxode2)
#> Warning: package 'rxode2' was built under R version 4.3.3#> rxode2 2.1.3 using 4 threads (see ?getRxThreads)#> no cache: create with `rxCreateCache()`
set.seed(123)
rxSetSeed(123)
# Setup the rxode2 event tableeventTable<- et(amt=320, evid=1, cmt=1, time=0) %>% # nolint: object_name_linter.
et(amt=320, evid=1, cmt=2, time=0) %>%
et(list(c(0.1, 0.4), # sampling windows for first profile
c(0.3, 0.9),
c(0.7, 1.5),
c(1.5, 2.5),
c(2.5, 4),
c(4, 6),
c(6, 8.5),
c(8.75, 10),
c( 10, 12),
c(23, 27))) %>%
et(amt=320, evid=4, time=72, cmt=1) %>% # reset & dose
et(amt=320, evid=1, time=72, cmt=2) %>% # dose afterward
et(list(c(72.1, 72.4),
c(72.3, 72.9),
c(72.7, 73.5),
c(73.5, 74.5),
c(74.5, 78.5),
c(76, 78),
c(78, 80.5),
c(80.75, 82),
c(82, 84),
c(95, 100))) %>%
et(id=1:14) # Number of subjects to sample# Now define the nlmixr2/rxode2 model used for both estimation and simulationmod<-function() {
# Parameters
ini({
tka<-0.45; label("Ka (first order absorption)")
trate<-0.4 ; label("Zero order rate")
tcl<-1; label("Cl")
tv<-3.45; label("V")
fDepot<- logit(0.5) ; label("amount of dose in first order absorption")
eta.ka~0.6eta.cl~0.3eta.v~0.1add.sd<-0.7
})
# and a model block with the error specification and model specification
model({
ka<- exp(tka+eta.ka)
cl<- exp(tcl+eta.cl)
v<- exp(tv+eta.v)
d/dt(depot) =-ka*depotd/dt(center) =ka*depot-cl/v*center
f(depot) <- expit(fDepot)
f(center) <-1-expit(fDepot)
rate(center) <- exp(trate)
cp=center/vcp~ add(add.sd)
})
}
mod<- mod()
# Simulate the datad<- nlmixr2(mod, eventTable, "rxSolve", control= rxControl(addDosing=TRUE))
d %>%
filter(evid==1)
#> Error: object 'evid' not found
The text was updated successfully, but these errors were encountered:
mattfidler
changed the title
Output keep dosing with evid=4 and reset seems to be giving some wrong values
Output keep dosing with evid=4 and reset seems to be missing some evid=1 with`!is.na(amt
Jul 23, 2024
mattfidler
changed the title
Output keep dosing with evid=4 and reset seems to be missing some evid=1 with`!is.na(amt
Output keep dosing with evid=4 and reset seems to be missing some evid=1 with!is.na(amt)Jul 23, 2024
Created on 2024-07-22 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: