Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Problems implementing F1 Bioavailability #33

Open
Anathawa opened this issue May 30, 2017 · 2 comments
Open

Problems implementing F1 Bioavailability #33

Anathawa opened this issue May 30, 2017 · 2 comments

Comments

@Anathawa
Copy link

Trying and failing miserably. :)

Using the premade model pk1_cmt_oral, I get this description:
ODE definition:

dAdt[1] = -KA*A[1];;
dAdt[2] = KA*A[1] - (CL/V)*A[2];;

;

Required parameters: KA, CL, V
Covariates:
Variables:
Number of compartments: 2
Observation compartment: 2
Observation scaling: V
Lag time:

The model has two compartments, with the amount of the chemical, 1 being the gut, 2 the central compartment i.e plasma?
And to get the concentration I need to decide on an observation compartment and scale it?
"Obs" here is compartment 2 (in mg) divided by the selected scaling variable V (L) giving me the concentration in mg / L?
(How does the model know scaling means division, not multiplication..?)

basemodel <- new_ode_model(
code = "
dAdt[1] = -KA * A[1]
dAdt[2] = +KA * A[1] -(CL/V) * A[2]
",obs = list(cmt = 2, scale = "V"))

gives me the same results as pk1_cmt_oral, and adding F1 should be

Bioavailability <- new_ode_model(
code = "
dAdt[1] = -KA * A[1]
dAdt[2] = +KA * A[1] -(CL/V) * A[2]
",obs = list(cmt = 2, scale = "V"),
dose = list(cmt = 1, bioav = "F1")

but this code gives me an error ( error: 'F1' was not declared in this scope)

and declaring it like this:
Bioavailability <- new_ode_model(
code = "
dAdt[1] = -KA * A[1]
dAdt[2] = +KA * A[1] -(CL/V) * A[2]
",obs = list(cmt = 2, scale = "V"),
dose = list(cmt = 1, bioav = "F1") declare_variables = c("F1")
)
gives me zero in all compartments

Hardcoding an F1 value doesn't change my results from not using any bioavailability data.

Bioavailability <- new_ode_model(
code = "
dAdt[1] = -KA * A[1]
dAdt[2] = +KA * A[1] -(CL/V) * A[2]
",obs = list(cmt = 2, scale = "V"),
dose = list(cmt = 1, bioav = 0.000000001)
)
has no effect?

Started looking for it in source code, but thought I'd better ask. :)

@ronkeizer
Copy link
Owner

How does the model know scaling means division, not multiplication..?

That is more or less by convention, this is how scaling is defined in NONMEM (and I suppose in Monolix too).

gives me zero in all compartments

I think the code is correct (the version where you declare F1 as variable too). Do you supply "F1" as a parameter (or as a covariate) when you run the simulation? (you should)

@philipdelff
Copy link

philipdelff commented Dec 11, 2018

Hi,

I just spend a little time getting exactly this working (on InsightRX/PKPDsim though). F1 should not be a defined as a variable, only a parameter. I found out by using ronkeizer's example from #35

Here is a full working example:

library(remotes)
install_github("InsightRX/PKPDsim")
library(PKPDsim)
library(ggplot2)

pk1 <- new_ode_model(code =
"
dAdt[1] = -KA * A[1]
dAdt[2] = +KA * A[1] -CL/V2 * A[2] + Q*(1/V3A[3] - 1/V2A[2])
dAdt[3] = Q*(1/V2A[2] - 1/V3A[3])"
,dose = list(cmt = 1, bioav = "F1") ### param goes here
,obs = list(cmt = 2, scale = "V2")
,parameters = c("F1","V2","CL","KA","V3","Q")
)

pars <- list(
KA = 1
,V2 = 1.5
,V3 = 3
,Q = .5
,CL =1
,F1 = .4
)

reg <- new_regimen(
,amt = 400
,times = c(0)
,cmt = c(1)
)

simres <- sim(
ode = pk1,
parameters = pars,
regimen = reg2,
t_obs = seq(0,24,by=.1)
)

ggplot(simres,aes(t,y,colour=comp))+geom_line()

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants