Hi everyone,
I am trying to simulate a two-compartment Rucaparib PopPK model in Pumas, based on the FDA model (Green et al., 2022).
When I run simobs, I get the following error:
ERROR: UndefVarError: F1 not defined in Main
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] (::var"#643#653")(_para@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, _rando@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, _subject::Subject{…})
@ Main .\none:983
[2] DCPObj
@ .\none:1070 [inlined]
[3] dcp(model::PumasModel{…}, subject::Subject{…}, para@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, randeff@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…})
@ Pumas .\none:3185
[4] _check_dose_compartments(model::PumasModel{…}, subject::Subject{…}, para@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, _randeff@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…})
@ Pumas .\none:5426
[5] _simobs(…)
- these are the model codes which i used
F1 is defined inside @pre, but Pumas throws UndefVarError: F1 not defined when evaluating @dosecontrol.
Is this due to scope rules between @pre and @dosecontrol?
Should F1 instead be defined differently (e.g., as a parameter or moved elsewhere)?
Any clarification on how variables from @pre are accessed inside @dosecontrol would be greatly appreciated.
Thanks in advance.
Dear,
Yes, it is because the dose control block cannot “see” the pre block variables. Instead, you can define them in dose control. The reason for this is one of efficiency. The dose control block is only evaluated whenever there are dose events and evaluating the full pre block adds unnecessary overhead. You should be able to write
@dosecontrol begin
F_total := …
D1i := …
bioav = (Depot0 = logistic(F_total),)
duration = (Depot0 = D1i,)
end
notice, that the same goes for the duration parameterization D1i . Also notice the use of := that means “define in this block but do not output from this block”. This is to ensure that people do not define lags incorrectly (say by defining a parameter called lag).
Best,
Patrick
Hi Patrick,
Thank you for the clarification. It worked perfectly and resolved the issue.
Best,
Bhargav