Translating HawkEars Confidence to Probability

Author

Barbara Frei

Published

May 26, 2026

Overview

This Quarto document translates HawkEars confidence scores into probabilities using species-specific logistic regression models.

The script loops through all species listed in species_code and creates: - a logistic regression model for each species - a probability plot - optional saved output figures

Load Libraries

#| label: load-libraries

library(tidyverse) library(dplyr) library(ggplot2)

#| label: load-data

Read in data created using Ana’s code:

Adding_confidence_levels.R

Spp_threshold.df <- read.csv(“Data/Spp_threshold.df”)

Create observed column for logistic regression

tag_rating == 1 = false positive

tag_rating == 5 = true positive

Spp_threshold.df <- Spp_threshold.df %>% mutate( observed = case_when( tag_rating == 1 ~ 0, tag_rating == 5 ~ 1, TRUE ~ NA_real_ ) ) %>% drop_na(observed)

Check structure

glimpse(Spp_threshold.df)