# Error with partial AUC

**URL:** <https://discourse.pumas.ai/t/error-with-partial-auc/852>\
**Category:** NCA\
**Created:** [March 19, 2023, 7:38pm UTC](https://discourse.pumas.ai/t/error-with-partial-auc/852 "2023-03-19T19:38:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![donaldlee3](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/donaldlee3/32/165_2.png) [@donaldlee3](https://discourse.pumas.ai/u/donaldlee3)\
**Post date:** [March 19, 2023, 7:38pm UTC](https://discourse.pumas.ai/t/error-with-partial-auc/852/1 "2023-03-19T19:38:02Z")

</div>

Hello,

I am running NCA on simulations, and I get an error for my partial AUCs that fail. Is there a way to still get the result with the partial AUC being `missing`? I am joining with cmax and aucinf results, so I still need the partial AUC. I tried the following, which doesn’t work because I still need the partial AUC object to join with the cmax and aucinf.

```auto
    auc57_90 = try
                    NCA.auc(NCApop, auctype = :last, interval = (57, 90))
                catch
                    missing
                end

```

Here is the error:

```auto
stacktrace:
"LoadError: On worker 2: UndefVarError: NCAresults_df not defined Stacktrace: [1] run_nca @ /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_fxns.jl:139 [2] #PBE_sims#32 @ /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_fxns.jl:232 [3] #33 @ /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_main.jl:32 [4] #110 @ /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:278 [5] run_work_thunk @ /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:63 [6] macro expansion @ /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:278 [inlined] [7] #109 @ ./task.jl:429 Stacktrace: [1] (::Base.var"#898#900")(x::Task) @ Base ./asyncmap.jl:177 [2] foreach(f::Base.var"#898#900", itr::Vector{Any}) @ Base ./abstractarray.jl:2712 [3] maptwice(wrapped_f::Function, chnl::Channel{Any}, worker_tasks::Vector{Any}, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}) @ Base ./asyncmap.jl:177 [4] wrap_n_exec_twice @ ./asyncmap.jl:153 [inlined] [5] #async_usemap#883 @ ./asyncmap.jl:103 [inlined] [6] #asyncmap#882 @ ./asyncmap.jl:81 [inlined] [7] pmap(f::Function, p::WorkerPool, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}; distributed::Bool, batch_size::Int64, on_error::Nothing, retry_delays::Vector{Any}, retry_check::Nothing) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:126 [8] pmap(f::Function, p::WorkerPool, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:101 [9] pmap(f::Function, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:156 [10] pmap(f::Function, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:156 [11] top-level scope @ timing.jl:220 [12] include(fname::String) @ Base.MainInclude ./client.jl:451 [13] top-level scope @ /opt/juliahub/code.jl:53 [14] include(fname::String) @ Base.MainInclude ./client.jl:451 [15] top-level scope @ none:1 [16] eval @ ./boot.jl:373 [inlined] [17] eval @ ./client.jl:453 [inlined] [18] eval_user_code(expression::Expr) @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:10 [19] #72 @ /opt/juliahub/master_startup.jl:194 [inlined] [20] cd(f::Main.JuliaRunJob.var"#72#81", dir::String) @ Base.Filesystem ./file.jl:110 [21] (::Main.JuliaRunJob.var"#71#80"{Main.JuliaRunJob.JobContext})() @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:193 [22] user_code_env(f::Main.JuliaRunJob.var"#71#80"{Main.JuliaRunJob.JobContext}, ctx::Main.JuliaRunJob.JobContext, require::Set{String}, allow::Set{String}, out::Set{String}) @ Main.JuliaRunJob /opt/juliahub/job_context.jl:406 [23] (::Main.JuliaRunJob.var"#68#77"{IOBuffer, Main.JuliaRunJob.JobContext})() @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:179 [24] macro expansion @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:22 [inlined] [25] macro expansion @ ./task.jl:399 [inlined] [26] _redirect_to_logger(f::Main.JuliaRunJob.var"#68#77"{IOBuffer, Main.JuliaRunJob.JobContext}, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}, level_for_logs::Base.CoreLogging.LogLevel, redirect_func::Base.RedirectStdStream, prev_stream::Base.PipeEndpoint, stream_name::Symbol) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:19 [27] (::Base.RedirectStdStream)(f::Function, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}; level::Base.CoreLogging.LogLevel) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:63 [28] RedirectStdStream @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:57 [inlined] [29] #67 @ /opt/juliahub/master_startup.jl:142 [inlined] [30] macro expansion @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:22 [inlined] [31] macro expansion @ ./task.jl:399 [inlined] [32] _redirect_to_logger(f::Main.JuliaRunJob.var"#67#76"{IOBuffer, Main.JuliaRunJob.JobContext, LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}}, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}, level_for_logs::Base.CoreLogging.LogLevel, redirect_func::Base.RedirectStdStream, prev_stream::Base.PipeEndpoint, stream_name::Symbol) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:19 [33] (::Base.RedirectStdStream)(f::Function, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}; level::Base.CoreLogging.LogLevel) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:63 [34] RedirectStdStream @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:57 [inlined] [35] (::Main.JuliaRunJob.var"#66#75"{IOBuffer, Main.JuliaRunJob.JobContext, LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}})() @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:141 [36] with_logstate(f::Function, logstate::Any) @ Base.CoreLogging ./logging.jl:511 [37] macro expansion @ /opt/juliahub/projects/internal_depot/packages/CloudWatchLogging/H5Z7n/src/logger.jl:272 [inlined] [38] macro expansion @ ./task.jl:399 [inlined] [39] with_logger(f::Function, logger::CloudWatchLogging.CloudWatchLogger, logstate::Base.CoreLogging.LogState; nretries::Int64, reset_error_count_secs::Int64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ CloudWatchLogging /opt/juliahub/projects/internal_depot/packages/CloudWatchLogging/H5Z7n/src/logger.jl:262 [40] with_logger @ /opt/juliahub/projects/internal_depot/packages/CloudWatchLogging/H5Z7n/src/logger.jl:255 [inlined] [41] with_logger(f::Function, logger::LoggingExtras.TransformerLogger{CloudWatchLogging.CloudWatchLogger, JuliaRunLoggers.var"#2#4"{Dict{Symbol, Any}, Dict{Symbol, Function}}}, logstate::Base.CoreLogging.LogState) @ JuliaRunLoggers /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:52 [42] with_logger(f::Function, logger::JuliaRunLoggers.JuliaRunLogger, logstate::Base.CoreLogging.LogState) @ JuliaRunLoggers /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:93 [43] #with_logger#6 @ /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:51 [inlined] [44] with_logger(f::Function, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}) @ JuliaRunLoggers /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:51 [45] execute_wrapped(config_io::IOBuffer, ctx::Main.JuliaRunJob.JobContext) @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:140 [46] main @ /opt/juliahub/master_startup.jl:121 [inlined] [47] main(config_io::IOBuffer) (repeats 2 times) @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:115 [48] top-level scope @ /opt/juliahub/master_startup.jl:229 [49] include(mod::Module, _path::String) @ Base ./Base.jl:418 [50] exec_options(opts::Base.JLOptions) @ Base ./client.jl:292 in expression starting at /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_main.jl:30 in expression starting at /opt/juliahub/code.jl:53"

```

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/andreasnoack/32/22_2.png) [@andreasnoack](https://discourse.pumas.ai/u/andreasnoack)\
**Post date:** [March 20, 2023, 7:32am UTC](https://discourse.pumas.ai/t/error-with-partial-auc/852/2 "2023-03-20T07:32:13Z")

</div>

Hi Donald

The stacktrace suggests that you are trying to refer to a variable named `NCAresults_df` in a file named `PBE_MPA_SD_pl_BE_fxns.jl` at line 139. I.e. the error isn’t thrown from a Pumas/NCA function. Maybe check where the `NCAresults_df` is defined if at all. If that doesn’t reveal the issue then you might need to share more details about your other scripts here for us to help.

Best  
Andreas

---

<div class="post-metadata">

**Author:** ![donaldlee3](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/donaldlee3/32/165_2.png) [@donaldlee3](https://discourse.pumas.ai/u/donaldlee3)\
**Post date:** [March 21, 2023, 2:15pm UTC](https://discourse.pumas.ai/t/error-with-partial-auc/852/3 "2023-03-21T14:15:05Z")

</div>

Hi Andreas,

I had uploaded the wrong error message. That error for was when I was trying to workaround the partial AUC failing problem. Here’s the original error:

```auto
stacktrace:
"LoadError: On worker 24: ArgumentError: invalid index: nothing of type Nothing Stacktrace: [1] to_index @ ./indices.jl:300 [2] to_index @ ./indices.jl:277 [3] to_indices @ ./indices.jl:333 [inlined] [4] to_indices @ ./indices.jl:325 [inlined] [5] getindex @ ./abstractarray.jl:1218 [inlined] [6] #_auc#323 @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/NCA/CDayS/src/auc.jl:178 [7] #auc_nokwarg#338 @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/NCA/CDayS/src/auc.jl:364 [inlined] [8] #auc#335 @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/NCA/CDayS/src/auc.jl:341 [inlined] [9] #1162 @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/NCA/CDayS/src/NCA.jl:117 [inlined] [10] iterate @ ./generator.jl:47 [inlined] [11] collect_to! @ ./array.jl:782 [12] collect_to_with_first! @ ./array.jl:760 [inlined] [13] collect @ ./array.jl:734 [14] map @ ./abstractarray.jl:2896 [inlined] [15] #auc#1156 @ /build/_work/PumasSystemImages/PumasSystemImages/julia_depot/packages/NCA/CDayS/src/NCA.jl:116 [16] run_nca @ /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_fxns.jl:136 [17] #PBE_sims#32 @ /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_fxns.jl:229 [18] #33 @ /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_main.jl:32 [19] #110 @ /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:278 [20] run_work_thunk @ /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:63 [21] macro expansion @ /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:278 [inlined] [22] #109 @ ./task.jl:429 Stacktrace: [1] (::Base.var"#898#900")(x::Task) @ Base ./asyncmap.jl:177 [2] foreach(f::Base.var"#898#900", itr::Vector{Any}) @ Base ./abstractarray.jl:2712 [3] maptwice(wrapped_f::Function, chnl::Channel{Any}, worker_tasks::Vector{Any}, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}) @ Base ./asyncmap.jl:177 [4] wrap_n_exec_twice @ ./asyncmap.jl:153 [inlined] [5] #async_usemap#883 @ ./asyncmap.jl:103 [inlined] [6] #asyncmap#882 @ ./asyncmap.jl:81 [inlined] [7] pmap(f::Function, p::WorkerPool, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}; distributed::Bool, batch_size::Int64, on_error::Nothing, retry_delays::Vector{Any}, retry_check::Nothing) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:126 [8] pmap(f::Function, p::WorkerPool, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:101 [9] pmap(f::Function, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:156 [10] pmap(f::Function, c::Base.Iterators.ProductIterator{Tuple{Vector{Float64}, Vector{Int64}}}) @ Distributed /opt/julia-1.7.3/share/julia/stdlib/v1.7/Distributed/src/pmap.jl:156 [11] top-level scope @ timing.jl:220 [12] include(fname::String) @ Base.MainInclude ./client.jl:451 [13] top-level scope @ /opt/juliahub/code.jl:53 [14] include(fname::String) @ Base.MainInclude ./client.jl:451 [15] top-level scope @ none:1 [16] eval @ ./boot.jl:373 [inlined] [17] eval @ ./client.jl:453 [inlined] [18] eval_user_code(expression::Expr) @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:10 [19] #72 @ /opt/juliahub/master_startup.jl:194 [inlined] [20] cd(f::Main.JuliaRunJob.var"#72#81", dir::String) @ Base.Filesystem ./file.jl:110 [21] (::Main.JuliaRunJob.var"#71#80"{Main.JuliaRunJob.JobContext})() @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:193 [22] user_code_env(f::Main.JuliaRunJob.var"#71#80"{Main.JuliaRunJob.JobContext}, ctx::Main.JuliaRunJob.JobContext, require::Set{String}, allow::Set{String}, out::Set{String}) @ Main.JuliaRunJob /opt/juliahub/job_context.jl:406 [23] (::Main.JuliaRunJob.var"#68#77"{IOBuffer, Main.JuliaRunJob.JobContext})() @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:179 [24] macro expansion @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:22 [inlined] [25] macro expansion @ ./task.jl:399 [inlined] [26] _redirect_to_logger(f::Main.JuliaRunJob.var"#68#77"{IOBuffer, Main.JuliaRunJob.JobContext}, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}, level_for_logs::Base.CoreLogging.LogLevel, redirect_func::Base.RedirectStdStream, prev_stream::Base.PipeEndpoint, stream_name::Symbol) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:19 [27] (::Base.RedirectStdStream)(f::Function, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}; level::Base.CoreLogging.LogLevel) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:63 [28] RedirectStdStream @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:57 [inlined] [29] #67 @ /opt/juliahub/master_startup.jl:142 [inlined] [30] macro expansion @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:22 [inlined] [31] macro expansion @ ./task.jl:399 [inlined] [32] _redirect_to_logger(f::Main.JuliaRunJob.var"#67#76"{IOBuffer, Main.JuliaRunJob.JobContext, LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}}, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}, level_for_logs::Base.CoreLogging.LogLevel, redirect_func::Base.RedirectStdStream, prev_stream::Base.PipeEndpoint, stream_name::Symbol) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:19 [33] (::Base.RedirectStdStream)(f::Function, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}; level::Base.CoreLogging.LogLevel) @ Logging2 /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:63 [34] RedirectStdStream @ /opt/juliahub/projects/internal_depot/packages/Logging2/EwyL4/src/Logging2.jl:57 [inlined] [35] (::Main.JuliaRunJob.var"#66#75"{IOBuffer, Main.JuliaRunJob.JobContext, LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}})() @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:141 [36] with_logstate(f::Function, logstate::Any) @ Base.CoreLogging ./logging.jl:511 [37] macro expansion @ /opt/juliahub/projects/internal_depot/packages/CloudWatchLogging/H5Z7n/src/logger.jl:272 [inlined] [38] macro expansion @ ./task.jl:399 [inlined] [39] with_logger(f::Function, logger::CloudWatchLogging.CloudWatchLogger, logstate::Base.CoreLogging.LogState; nretries::Int64, reset_error_count_secs::Int64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ CloudWatchLogging /opt/juliahub/projects/internal_depot/packages/CloudWatchLogging/H5Z7n/src/logger.jl:262 [40] with_logger @ /opt/juliahub/projects/internal_depot/packages/CloudWatchLogging/H5Z7n/src/logger.jl:255 [inlined] [41] with_logger(f::Function, logger::LoggingExtras.TransformerLogger{CloudWatchLogging.CloudWatchLogger, JuliaRunLoggers.var"#2#4"{Dict{Symbol, Any}, Dict{Symbol, Function}}}, logstate::Base.CoreLogging.LogState) @ JuliaRunLoggers /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:52 [42] with_logger(f::Function, logger::JuliaRunLoggers.JuliaRunLogger, logstate::Base.CoreLogging.LogState) @ JuliaRunLoggers /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:93 [43] #with_logger#6 @ /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:51 [inlined] [44] with_logger(f::Function, logger::LoggingExtras.EarlyFilteredLogger{JuliaRunLoggers.JuliaRunLogger, CloudWatchLogging.var"#44#46"{Float64, Base.CoreLogging.LogLevel, CloudWatchLogging.TokenBucket}}) @ JuliaRunLoggers /opt/juliahub/projects/internal_depot/packages/JuliaRunLoggers/AWTYh/src/JuliaRunLoggers.jl:51 [45] execute_wrapped(config_io::IOBuffer, ctx::Main.JuliaRunJob.JobContext) @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:140 [46] main @ /opt/juliahub/master_startup.jl:121 [inlined] [47] main(config_io::IOBuffer) (repeats 2 times) @ Main.JuliaRunJob /opt/juliahub/master_startup.jl:115 [48] top-level scope @ /opt/juliahub/master_startup.jl:229 [49] include(mod::Module, _path::String) @ Base ./Base.jl:418 [50] exec_options(opts::Base.JLOptions) @ Base ./client.jl:292 in expression starting at /opt/juliahub/appbundle/PBE_MPA_SD_pl_BE_main.jl:30 in expression starting at /opt/juliahub/code.jl:53"

```

I’m not too concerned at the moment as to why some partial AUCs from simulated subjects are failing. When I do a fewer number of simulations, the code runs fine, but occasionally, with larger runs, I’m getting this error that I’ve concluded is coming from the partial AUCs.

Below is the function I’m using to run the NCA:

```auto
function run_nca(sims_df::DataFrame)
    # removes neg conc's to prevent neg conc warning printout from NCA
    # have to use coalesce b/c of missing values
    temp_df = sims_df[coalesce.(sims_df.dv .>= 0, true), :]

    NCApop = read_nca(temp_df,
                        id = :id,
                        time = :time,
                        observations = :dv,
                        amt = :amt,
                        group = [:rep_PBE, :Nsubj_PBE, :occ, :period, :sequence, :seq_n, :formulation, :isT, :input_tr_ratio],
                        llq = 0.02,
                        route = :route)

    cmax = NCA.cmax(NCApop)
    aucinf = NCA.auc(NCApop)
    auc57_90 = NCA.auc(NCApop, auctype = :last, interval = (57, 90))
        
    NCAresults_df = leftjoin(cmax, aucinf, on = [:id, :rep_PBE, :Nsubj_PBE, :occ, :period, :sequence, :seq_n, :formulation, :isT, :input_tr_ratio])
    NCAresults_df = leftjoin(NCAresults_df, auc57_90, on = [:id, :rep_PBE, :Nsubj_PBE, :occ, :period, :sequence, :seq_n, :formulation, :isT, :input_tr_ratio])

    return NCAresults_df
end

```

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/andreasnoack/32/22_2.png) [@andreasnoack](https://discourse.pumas.ai/u/andreasnoack)\
**Post date:** [March 24, 2023, 3:31pm UTC](https://discourse.pumas.ai/t/error-with-partial-auc/852/4 "2023-03-24T15:31:58Z")

</div>

The issue here is that NCA ends up throwing an exception when there are no observations in the interval for which the AUC is requested. The reason for the missing observations is that they are below the limit of quantification. However, NCA should have return a `missing` instead of throwing an exception. This will be fixed in the next release.
