# NCA returns missing AUC for AUClast

**URL:** <https://discourse.pumas.ai/t/nca-returns-missing-auc-for-auclast/1016>\
**Category:** NCA\
**Created:** [April 20, 2024, 2:30am UTC](https://discourse.pumas.ai/t/nca-returns-missing-auc-for-auclast/1016 "2024-04-20T02:30:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahulub3r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/rahulub3r/32/182_2.png) [@Rahulub3r](https://discourse.pumas.ai/u/Rahulub3r)\
**Post date:** [April 20, 2024, 2:30am UTC](https://discourse.pumas.ai/t/nca-returns-missing-auc-for-auclast/1016/1 "2024-04-20T02:30:57Z")

</div>

Hi, when calculating AUC in a time interval, I am getting a message that the slope cannot be calculated and the AUC output is missing. I wanted to ask if this behavior is expected where there is no need to calculate the terminal slope. Please note that the LLQ is 0.04 units and I want to set the BLQ to 0 when calculating NCA parameters.

Input:

```auto
a = DataFrame(
    id = "1", 
    amt = vcat(10., fill(0, 10)), 
    evid = vcat(1, fill(0, 10)), route = "ev",
    time = [0., 3.0, 5.0, 7.0, 10.,14.,17.,21.,23.,25.,28.],
    dv = [missing, 5.0, 3.0, 0.07, 0.09, 0.048, 0.06, 0.08, 0.083, 0.027, 0.022]
)
a_ncaobj = read_nca(a, observations = Symbol("dv"), concblq = 0, llq = 0.04)
NCA.auc(a_ncaobj; interval = (7,28), auctype=:last)

```

Output:

```auto
[ Info: ID 1 errored: the estimated slope is not negative, got 0.06330922513744856
1×2 DataFrame
 Row │ id auc7_28
     │ String Missing
─────┼─────────────────
   1 │ 1 missing

```

---

<div class="post-metadata">

**Author:** ![vijay](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/vijay/32/96_2.png) [@vijay](https://discourse.pumas.ai/u/vijay)\
**Post date:** [April 23, 2024, 8:01am UTC](https://discourse.pumas.ai/t/nca-returns-missing-auc-for-auclast/1016/2 "2024-04-23T08:01:48Z")

</div>

hi @Rahulub3r - since you set the `concblq` to a scalar value of `0`, you are replacing 0.027 and 0.022 with `0`. So, the time points 25 and 28 are essentially `BLQ` where you are requesting the value to be zero. Now, you are requesting the interval auc between 7 and 28 (where 28 is BLQ and is technically zero). I agree that it should not give missing, but essentially what you really wanted was this below?

```julia
julia> NCA.auc(a_ncaobj; interval = (7,23))
1×2 DataFrame
 Row │ id auc7_23
     │ String Float64
─────┼─────────────────
   1 │ 1 1.121

```

Right?

---

<div class="post-metadata">

**Author:** ![Rahulub3r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/rahulub3r/32/182_2.png) [@Rahulub3r](https://discourse.pumas.ai/u/Rahulub3r)\
**Post date:** [April 23, 2024, 11:56am UTC](https://discourse.pumas.ai/t/nca-returns-missing-auc-for-auclast/1016/3 "2024-04-23T11:56:57Z")

</div>

No, I want the function to calculate AUC7-25 by setting the concentration at 25 to 0. I am able to make it work by setting concblq to a small non-zero value in `read_nca` but that’s not ideal because the value I set is arbitrary. Hope this is clear

```auto
julia> a_ncaobj = read_nca(a, observations = Symbol("dv"), concblq = 0.0001, llq = 0.04)
NCAPopulation (1 subjects):
  Number of missing observations: 1
  Number of blq observations: 2

julia> NCA.auc(a_ncaobj; interval = (7,23), auctype=:last)
1×2 DataFrame
 Row │ id auc7_23
     │ String Float64
─────┼─────────────────
   1 │ 1 1.121

julia> NCA.auc(a_ncaobj; interval = (7,28), auctype=:last)
1×2 DataFrame
 Row │ id auc7_28
     │ String Float64
─────┼─────────────────
   1 │ 1 1.2044

# What I want:
julia> NCA.auc(a_ncaobj; interval = (7,25), auctype=:last)
1×2 DataFrame
 Row │ id auc7_25
     │ String Float64
─────┼─────────────────
   1 │ 1 1.2041

```
