Calculating Confidence Intervals for Mean "Smoothed" Occupancy Estimates from Dynamic Occupancy Models

34 views
Skip to first unread message

Sujay Singh

unread,
Jun 6, 2025, 9:56:50 PMJun 6
to unmarked
Hi, 

I am using camera trap data and trying to plot estimates of "smoothed" occupancy for coyotes across my study area. I have 9 primary (2016-2024) sampling occasions, 3 secondary (June-August) sampling occasions, and 68 sites. "Sites" are defined as 14 km2 grid cells here. Coyotes, are prevalent across my study area, and consequently had extremely high smoothed occupancy probabilities each year across this relatively broad spatial scale. My goal is to use a line plot to portray mean smoothed occupancy probabilities across all my sites for each year, along with the associated 95% confidence intervals (CI). One method I was originally trying to implement was to use a 1000 iteration non-parametric bootstrap to calculate standard errors (SE) associated with each years' mean smoothed occupancy probability, and then multiply these SE's by 1.96 while adding or subtracting from the occupancy estimates. For example, see the code below:

fm <- colext(~ 1, ~ 1, ~ 1, ~ effort, umf) # Fit model
fm.1 <-  nonparboot(fm, B = 1000) # Non-parametric bootstrap 

predicted_occ.Coyote <- data.frame(year = c(2016:2024),
                                                                 smoothed_occ = smoothed(fm.1)[2,],
                                                                 SE = fm...@smoothed.mean.bsse[2,],
                                                                 Lower_CI = smoothed(fm.1)[2,] -                                                                                                     1.96*fm...@smoothed.mean.bsse[2,],
                                                                 Upper_CI = smoothed(fm.1)[2,] +                                                                                                     1.96*fm...@smoothed.mean.bsse[2,])


Below are screenshots of what the above data frame looks like, along with a corresponding line plot of smoothed occupancy & CI's over time:
Smoothed_Occ_Data_Frame_For_Help_Group.png
Coyote_Occ_Null_Model.jpeg

The issue I am running into using the above method for calculating CI's is that my upper CI's are all > 1.0. In theory, occupancy probabilities cannot be > 1.0. Does anyone have an alternate way of calculating CI's that are bound between 0-1 for smoothed occupancy probabilities, using the non-parametric bootstrap approach?

Thank you!
Sujay

Jim Baldwin

unread,
Jun 7, 2025, 1:30:22 AMJun 7
to unma...@googlegroups.com
Here's a brute-force approach.  First capture the 1,000 "smoothed" bootstrap estimates for the 9 occupancy probabilities:

bsamples <- matrix(rep(NA, 1000*9), nrow=1000, ncol=9)
for (i in 1:1000) {
    bsamples[i,] <- smoothed(fm.1@bootstrapSamples[[i]])[2,]
}

Then in your data frame use

Upper_CL = apply(bsamples, 2, quantile, probs = 0.975, na.rm = TRUE),
Lower_CL = apply(bsamples, 2, quantile, probs = 0.025, na.rm = TRUE))

Jim



--
*** Three hierarchical modeling email lists ***
(1) unmarked (this list): for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology: for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2016, 2021) and Schaub & Kéry (2022)
---
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/unmarked/159ad2d3-d7d9-49fa-bad8-da302c0b142an%40googlegroups.com.

Sujay Singh

unread,
Jun 14, 2025, 9:17:55 PMJun 14
to unma...@googlegroups.com
Hi Jim,

Sorry for the late reply, but I just tried your suggested approach and it worked. Thank you very much!

-Sujay

Reply all
Reply to author
Forward
0 new messages