# \[ANN\] LimitOfDetection.jl - Easily estimate limit of detection

**URL:** https://discourse.julialang.org/t/ann-limitofdetection-jl-easily-estimate-limit-of-detection/99852
**Category:** Package Announcements
**Created:** [June 4, 2023, 3:54pm UTC](https://discourse.julialang.org/t/ann-limitofdetection-jl-easily-estimate-limit-of-detection/99852 "2023-06-04T15:54:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)
#### Post date: [June 4, 2023, 3:54pm UTC](https://discourse.julialang.org/t/ann-limitofdetection-jl-easily-estimate-limit-of-detection/99852/1 "2023-06-04T15:54:46Z")

</div>

A modest package that does a single thing (hopefully well) : estimate a limit of detection from data. The limit of detection (LoD) is the lowest value of a variable, e.g. x at which an event can be detected with a given sensitivity. For example, a smoke detector that triggers at a concentration of 15,000 particles per cm^3 with 95% probability has a 95%-LoD of 15,000.

> **[GitHub - jonathanBieler/LimitOfDetection.jl: Estimate LoD from data](https://github.com/jonathanBieler/LimitOfDetection.jl)**
>
> Estimate LoD from data

The model use standard probit/logit regression but I added sampling to estimate confidence intervals on the LoD. Also comes with a plot recipee.

 ![lod_plot](https://global.discourse-cdn.com/julialang/original/3X/0/6/06f9cfa368d14484068f71c0abfb00129e530177.png)

### Example

```julia
using LimitOfDetection

# generate artificial data   
x = LinRange(0,1,100)
link = ProbitLink()
f = x -> LimitOfDetection.GLM.linkinv(link, 10*x - 5)
Pcall = f.(x) 
detected = [rand() < P for P in Pcall]

# fit model
model = fit(LoDModel, x, detected; Nsamples = 50_000, sensitivity = 0.95, link = ProbitLink())
    
julia> model
Limit of Detection:
────────────────────────────────────────────────────────────
              MLE Mean Std Lower 90% Upper 90%
────────────────────────────────────────────────────────────
95%-LoD 0.670671 0.670189 0.0134975 0.648664 0.693332
────────────────────────────────────────────────────────────

julia> using Plots; plot(model)

```
