Hi @donaldlee3, a reproducer would be helpful. I’ve made certain assumptions and tried to reproduce what you are asking for, and here is what I see. Please note the following points:
- default
NCA.auc
computes 0-inf
.
- when you specify an interval calculation using the
kwarg
interval = (tstart, tstop)
, if you are tstop
is missing
concentration, than the interval calculation will be missing as expected as there is no way of learning what that data point is without having a lambdaz
to begin with.
Here is reproducer you can go through and let us know if you still think this is an issue.
julia> using NCA
julia> using PharmaDatasets
julia> df1 = DataFrame(;
id = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2],
time = [0, 1, 2, 3, 4, 0, 1, 2, 3, 4],
amt = [10, 0, 0, 0, 0, 10, 0, 0, 0, 0],
conc = [missing, 8, 6, 4, 2, missing, 8, 6, missing, missing],
route = ["iv", "iv", "iv", "iv", "iv", "iv", "iv", "iv", "iv", "iv"],
)
10×5 DataFrame
Row │ id time amt conc route
│ Int64 Int64 Int64 Int64? String
─────┼──────────────────────────────────────
1 │ 1 0 10 missing iv
2 │ 1 1 0 8 iv
3 │ 1 2 0 6 iv
4 │ 1 3 0 4 iv
5 │ 1 4 0 2 iv
6 │ 2 0 10 missing iv
7 │ 2 1 0 8 iv
8 │ 2 2 0 6 iv
9 │ 2 3 0 missing iv
10 │ 2 4 0 missing iv
julia> ncapop = read_nca(df1)
NCAPopulation (2 subjects):
Number of missing observations: 4
Number of blq observations: 0
julia> NCA.lambdaz(ncapop)
[ Info: ID 2 errored: lambdaz calculation needs at least three data points between Cmax and the last positive concentration
2×2 DataFrame
Row │ id lambdaz
│ String Float64?
─────┼────────────────────────
1 │ 1 0.549306
2 │ 2 missing
julia> NCA.auc(ncapop)
[ Info: ID 2 errored: lambdaz calculation needs at least three data points between Cmax and the last positive concentration
2×2 DataFrame
Row │ id auc
│ String Float64?
─────┼──────────────────────
1 │ 1 27.9743
2 │ 2 missing
julia> NCA.auc(ncapop, interval = (0, 2))
2×2 DataFrame
Row │ id auc0_2
│ String Float64
─────┼─────────────────
1 │ 1 16.3333
2 │ 2 16.3333
julia> NCA.auc(ncapop, interval = (0, 3))
[ Info: ID 2 errored: lambdaz calculation needs at least three data points between Cmax and the last positive concentration
2×2 DataFrame
Row │ id auc0_3
│ String Float64?
─────┼──────────────────────
1 │ 1 21.3333
2 │ 2 missing