Skip to contents

Multi-season models follow the same sites through several seasons, and ask how occupancy changes between them. This vignette uses project 0010, shipped with WildObsR: 28 camera stations in Woomargama National Park, New South Wales, that ran almost continuously for ten months in 2021–22. It builds on Detection histories and sampling effort and Fit single-season models.

How WildObs splits a long survey

When curating data for the database, WildObs splits long-term sampling into single-season surveys, called deploymentGroups, of at most 100 days, so each can be modelled as one closed season. The WildObsR function survey_and_deployment_generator() defines them from the timing of the records. Here it rebuilds 0010’s surveys from its observations:

# load the R packages
library(WildObsR)      # for data access and wrangling
library(unmarked)      # for multi-season occupancy models
library(spOccupancy)   # for Bayesian multi-season occupancy models

# grab the Woomargama project shipped with WildObsR
dp <- example_datapackages("NSW_Woomargama_wombats_Linley_2021-22_WildObsID_0010")[[1]]
# extract the deployments and observations, read with their schema types
deps <- frictionless::read_resource(dp, "deployments")
obs <- frictionless::read_resource(dp, "observations")

# remove obscured observations
caps <- obs[!grepl("^obscured_for_", obs$deploymentID), ]
# merge locationName (the project's landscape) to observations via deploymentID
caps <- merge(caps, deps[, c("deploymentID", "locationName")], by = "deploymentID")

# the survey generator needs a dataSource column, which it uses to name the surveys
caps$dataSource <- dp$name
# it also needs every deployment to have records, so keep the deployments with at least
# one record left after removing the obscured ones
deps_rec <- deps[deps$deploymentID %in% caps$deploymentID, ]

# group the records into surveys of at most 100 days (default settings)
caps <- survey_and_deployment_generator(caps, deps_rec)

# look up the deploymentGroups (surveys) WildObs recorded for each record's deployment
recorded <- deps$deploymentGroups[match(caps$deploymentID, deps$deploymentID)]
# compile the records in each rebuilt survey, beside the survey WildObs recorded
table(rebuilt = caps$new_deploymentGroups, recorded = sub("_Linley.*", "", recorded))
#>                               recorded
#> rebuilt                        Woomargama_NP_2021_a Woomargama_NP_2021_b
#>   Woomargama_NP_2021_a_2021-22                 5246                    0
#>   Woomargama_NP_2021_b_2021-22                    0                 6383
#>   Woomargama_NP_2022_a_2021-22                    0                    0
#>   Woomargama_NP_2022_b_2021-22                    0                    0
#>                               recorded
#> rebuilt                        Woomargama_NP_2022_a Woomargama_NP_2022_b
#>   Woomargama_NP_2021_a_2021-22                    0                    0
#>   Woomargama_NP_2021_b_2021-22                    0                    0
#>   Woomargama_NP_2022_a_2021-22                 5138                    0
#>   Woomargama_NP_2022_b_2021-22                    0                  216

The rebuilt surveys match the four recorded ones. The data package already holds them, so you rarely need to run this yourself. You can inspect the start and stop dates of each survey in the metadata:

# grab the start and end of each survey, from the temporal metadata
blocks <- dp$temporal[grepl("WildObsID", names(dp$temporal))]
# compile into a table for display
data.frame(survey = names(blocks), start = sapply(blocks, `[[`, "start"),
           end = sapply(blocks, `[[`, "end"), row.names = NULL)
#>                                       survey      start        end
#> 1 Woomargama_NP_2021_a_Linley_WildObsID_0010 2021-06-27 2021-10-05
#> 2 Woomargama_NP_2021_b_Linley_WildObsID_0010 2021-10-05 2022-01-13
#> 3 Woomargama_NP_2022_a_Linley_WildObsID_0010 2022-01-13 2022-04-23
#> 4 Woomargama_NP_2022_b_Linley_WildObsID_0010 2022-04-23 2022-04-28

# and calculate the total duration (in days) from overall start and stop dates, including the start date (+1)
total_dur <- as.numeric(difftime(dp$temporal$end, dp$temporal$start, units = "days")) + 1
total_dur
#> [1] 306

Notice the end date of a prior survey shares the start date of the next survey, indicating that the continuous sampling was split into 100-day blocks. The fourth survey lasted only a few days, so we fold it into the third season when preparing the analysis.

Rebuild long-term deployments

Because surveys end at 100 days, a camera that ran for ten months appears as several deployments. The WildObsR function recombine_deployment_groups() joins them back into one deployment per camera location within each multiSeason_deploymentGroup, and keeps a crosswalk to the original 100-day deployments (i.e., pieces):

# rebuild the data package with one deployment per camera per multi-season group
dp_long <- recombine_deployment_groups(dp)
#> NSW_Woomargama_wombats_Linley_2021-22_WildObsID_0010: 94 obscured observations row(s) kept unchanged in recombine_deployment_groups(); they have no camera to join to.

# extract the rebuilt deployments, and the crosswalk to the original pieces
deps_long <- frictionless::read_resource(dp_long, "deployments")
crosswalk <- frictionless::read_resource(dp_long, "deployment_crosswalk")
# also extract the observations, now pointing at the rebuilt deployments
obs_long <- frictionless::read_resource(dp_long, "observations")

# compare the number of deployments before and after
c(original = nrow(deps), rebuilt = nrow(deps_long))
#> original  rebuilt 
#>      219       57

# confirm the locationIDs remain unchanged from the 100-day deployments
setdiff(deps$locationID, deps_long$locationID)
#> character(0)
# and the reverse
setdiff(deps_long$locationID, deps$locationID)
#> character(0)

Effort on a shared calendar

A multi-season model needs occasion k to cover the same dates at every site, so the align = "calendar" parameter in the WildObsR effort_matrix() function starts every station’s occasions on the first day of the project. The crosswalk takes effort from the original pieces, so any gap between them counts as no effort.

We model three seasons by folding the short fourth survey into the third season. Its six extra days make the third season slightly longer than the others.

With 10-day occasions over the 306 days, each season has 10 occasions, and the third season gains an 11th occasion of 6 days, with less sampling effort than the others:

# camera-days per station (locationID) and 10-day occasion, over the whole project
eff <- effort_matrix(deps_long, site_col = "locationID", w = 10, dur = total_dur,
                     # put every station on one calendar, and take effort from the original pieces via the crosswalk
                     align = "calendar", crosswalk = crosswalk,
                     # specify the project's timezone
                     time_zone = dp$temporal$timeZone)

# grab the start date of every occasion
occ_start <- unique(eff$occasions[, c("occasion", "start")])$start
# define the survey each occasion starts in: the last survey that began on or before it
season <- vapply(occ_start, function(s) {
  # the surveys that had begun by this date
  begun <- vapply(blocks, function(b) as.Date(b$start) <= s, logical(1))
  # take the latest of them
  names(blocks)[max(which(begun))]
}, character(1))
# fold the short fourth survey into the third season
season[season == names(blocks)[4]] <- names(blocks)[3]

# view how many occasions each season holds
table(season)
#> season
#> Woomargama_NP_2021_a_Linley_WildObsID_0010 
#>                                         10 
#> Woomargama_NP_2021_b_Linley_WildObsID_0010 
#>                                         10 
#> Woomargama_NP_2022_a_Linley_WildObsID_0010 
#>                                         11

Covariates that change each season

Recombining 100-day deployments into multi-season deployments averages each covariate over a camera’s entire duration, so weather that changes between seasons is lost. The original covariates table has one row per 100-day deployment, with its station and survey, so covariates that change each season come from there instead. Covariates that stay the same, such as altitude, need one value per station:

# grab the covariates of the original 100-day deployments, each with its station and survey
covs <- frictionless::read_resource(dp, "covariates")
# leave out the short fourth survey, so its short window does not skew the third season
covs <- covs[covs$deploymentGroups != names(blocks)[4], ]

## extract rainfall and temperature covariates by averaging values in each survey: station x season
rain <- tapply(covs$mean_monthly_precipitation_point, list(covs$locationID, covs$deploymentGroups), mean)
temp <- tapply(covs$mean_monthly_temperature_point, list(covs$locationID, covs$deploymentGroups), mean)
# order the stations and seasons to match the effort matrix
rain <- rain[rownames(eff$effort), unique(season)]
temp <- temp[rownames(eff$effort), unique(season)]

# view the mean monthly temperature of the first three stations in each season
round(head(temp, 3), 1)
#>                   Woomargama_NP_2021_a_Linley_WildObsID_0010
#> 1_WildObsID_0010                                         6.5
#> 10_WildObsID_0010                                        7.5
#> 11_WildObsID_0010                                        7.4
#>                   Woomargama_NP_2021_b_Linley_WildObsID_0010
#> 1_WildObsID_0010                                        11.2
#> 10_WildObsID_0010                                       12.5
#> 11_WildObsID_0010                                       12.4
#>                   Woomargama_NP_2022_a_Linley_WildObsID_0010
#> 1_WildObsID_0010                                        21.4
#> 10_WildObsID_0010                                       22.7
#> 11_WildObsID_0010                                       22.6

# altitude does not change between seasons, so average it to one value per station
elev <- aggregate(altitude_point ~ locationID, data = covs, FUN = mean)
# view the first few stations
head(elev, 3)
#>          locationID altitude_point
#> 1  1_WildObsID_0010          638.5
#> 2 10_WildObsID_0010          486.0
#> 3 11_WildObsID_0010          550.0

Colonisation and extinction in unmarked

The black rat (Rattus rattus), an introduced species, was detected at multiple stations across each season. The function colext() from unmarked estimates the occupancy of the first season, then the probability that an empty station is colonised and that an occupied one goes extinct between seasons. It takes covariates that differ among stations (siteCovs), covariates that also change between seasons (yearlySiteCovs), and detection covariates that change each occasion (obsCovs):

# create the detection history of black rats in each station and occasion
y_rat <- detection_matrix(obs = obs_long, effort = eff, scientificNames = "Rattus rattus", type = "occupancy")
#> detection_matrix(): set aside 94 obscured observation(s), which carry no camera.
#> Detection histories from public data under-count those species where they are listed.

# format the matrix for unmarked, using one site covariate for elevation
umf <- model_matrix_input(detections = y_rat, effort = eff, site_covs = elev,
                          # and specifying the season of every occasion
                          seasons = season, output = "unmarked")
# add the covariates that change each season, one row per station and season, station by station
unmarked::yearlySiteCovs(umf) <- data.frame(rain = as.vector(t(rain)), temp = as.vector(t(temp)))

# view the number of stations, seasons and occasions in total
c(stations = unmarked::numSites(umf), seasons = umf@numPrimary, occasions = ncol(unmarked::getY(umf)))
#>  stations   seasons occasions 
#>        28         3        33

In addition to the occupancy formula (psiformula) and detection probability formula (pformula) shared with single-season occupancy models, colext() adds formulas for colonisation probability (gammaformula) and extinction probability (epsilonformula) from one season to the next. Another departure from the single-season occupancy model is that psiformula describes occupancy in the first season only. A season’s yearlySiteCovs act on the change to the next season, so the last season’s values are not used.

# fit the multi-season occupancy model, where altitude affects the first season
rat_colext <- colext(psiformula = ~ scale(altitude_point),
                     # rainfall affects colonisation, and temperature affects extinction
                     gammaformula = ~ scale(rain), epsilonformula = ~ scale(temp),
                     # and detection changes with effort
                     pformula = ~ scale(effort), data = umf)
# view the model results
rat_colext
#> 
#> Call:
#> colext(psiformula = ~scale(altitude_point), gammaformula = ~scale(rain), 
#>     epsilonformula = ~scale(temp), pformula = ~scale(effort), 
#>     data = umf)
#> 
#> Initial (logit-scale):
#>                       Estimate    SE     z P(>|z|)
#> (Intercept)              0.292 0.383 0.762   0.446
#> scale(altitude_point)    0.070 0.391 0.179   0.858
#> 
#> Colonization (logit-scale):
#>             Estimate    SE     z P(>|z|)
#> (Intercept)    0.693 0.490  1.41   0.157
#> scale(rain)   -0.678 0.491 -1.38   0.167
#> 
#> Extinction (logit-scale):
#>             Estimate    SE     z  P(>|z|)
#> (Intercept)   -1.629 0.491 -3.32 0.000896
#> scale(temp)   -0.594 0.486 -1.22 0.221967
#> 
#> Detection (logit-scale):
#>               Estimate     SE      z P(>|z|)
#> (Intercept)    -0.0946 0.0823 -1.149   0.251
#> scale(effort)  -0.0752 0.0785 -0.958   0.338
#> 
#> AIC: 939.0988 
#> Number of sites: 28

# the share of stations occupied in each season, for the population and for these 28 stations
rbind(population = rat_colext@projected.mean["occupied", ],
      these_stations = smoothed(rat_colext)["occupied", ])
#>                        1         2         3
#> population     0.5723465 0.6403239 0.8626964
#> these_stations 0.5723484 0.6439196 0.8577212

Occupancy rose from winter 2021 to summer 2022 because colonisation outweighed extinction. At average rainfall and temperature, an empty station had about a 67% chance of being colonised between seasons, and an occupied one about a 16% chance of going extinct (the intercepts, back-transformed with plogis()). None of the covariates had a significant effect (P(>|z|) < 0.05) on its parameter; they are here to show how each kind of covariate enters the model.

Occupancy over time in spOccupancy

The function tPGOcc() from the spOccupancy package models occupancy in each season directly, here from covariates in each season, rather than through colonisation and extinction. Its y is station x season x occasion:

# format the detections for spOccupancy, with site covariates and a season dimension
rat_sp <- model_matrix_input(y_rat, eff, site_covs = elev, seasons = season, output = "spOccupancy")
# view station x season x occasion dimensions
dim(rat_sp$y)
#> [1] 28  3 11

# the number of stations
n_station <- nrow(rat_sp$y)
# make the occupancy covariates a list, so covariates that change each season can join elevation
rat_sp$occ.covs <- as.list(rat_sp$occ.covs)
# a station x season matrix of season numbers, for a trend in occupancy (~ season)
rat_sp$occ.covs$season <- matrix(1:3, n_station, 3, byrow = TRUE)
# add the station x season covariates
rat_sp$occ.covs$rain <- rain
rat_sp$occ.covs$temp <- temp
# the season of every station, season and occasion, for detection
rat_sp$det.covs$season <- array(rep(1:3, each = n_station), dim = dim(rat_sp$y))
# number each station, for a random intercept in detection
rat_sp$det.covs$station <- seq_len(n_station)

Note that unlike unmarked, tPGOcc() has no colonisation or extinction parameters. Instead, it models occupancy in each season directly, though you can link neighbouring seasons through a temporal random effect by specifying the parameter ar1 = TRUE. Here occupancy follows a trend across the seasons (season), with the altitude and rainfall covariates from the unmarked model. Temperature is left out: it rose with the seasons (a correlation of 0.97 with season here), so the model cannot tell a temperature effect from the trend. colext() had no such problem, because temperature acted on extinction there and no other term followed the seasons.

To compare like with like, the first model uses the same detection formula as colext():

# make the chains repeatable
set.seed(1)
# fit the multi-season model, with a trend across seasons plus altitude and rainfall on occupancy,
rat_t <- tPGOcc(occ.formula = ~ scale(altitude_point) + scale(rain) + season,
                # detection changing with effort, as in colext()
                det.formula = ~ scale(effort),
                # and specify the data source and MCMC settings
                data = rat_sp, n.batch = 600, batch.length = 25, n.burn = 5000,
                n.thin = 10, n.chains = 3, verbose = FALSE)
# view the results
summary(rat_t)
#> 
#> Call:
#> tPGOcc(occ.formula = ~scale(altitude_point) + scale(rain) + season, 
#>     det.formula = ~scale(effort), data = rat_sp, n.batch = 600, 
#>     batch.length = 25, verbose = FALSE, n.burn = 5000, n.thin = 10, 
#>     n.chains = 3)
#> 
#> Samples per Chain: 15000
#> Burn-in: 5000
#> Thinning Rate: 10
#> Number of Chains: 3
#> Total Posterior Samples: 3000
#> Run Time (min): 0.1065
#> 
#> Occurrence (logit scale): 
#>                          Mean     SD    2.5%     50%  97.5%   Rhat  ESS
#> (Intercept)           -0.3092 0.6164 -1.5272 -0.3057 0.9187 0.9998 3000
#> scale(altitude_point) -0.0717 0.2549 -0.5824 -0.0710 0.4212 1.0037 3000
#> scale(rain)            0.2421 0.2708 -0.2798  0.2435 0.7852 1.0056 3000
#> season                 0.6269 0.3199  0.0115  0.6252 1.2759 1.0008 3000
#> 
#> Detection (logit scale): 
#>                  Mean     SD    2.5%     50%  97.5%   Rhat  ESS
#> (Intercept)   -0.0942 0.0818 -0.2525 -0.0940 0.0661 1.0003 3168
#> scale(effort) -0.0759 0.0810 -0.2395 -0.0771 0.0844 1.0006 3000

psi.samples holds the occupancy probability of every station in every season, for every posterior sample. Averaged over stations and samples, it gives the expected share of stations occupied in each season, which colext() also estimates:

# the share of stations occupied in each season, from each approach
rbind(colext = rat_colext@projected.mean["occupied", ],
      tPGOcc = apply(rat_t$psi.samples, 3, mean))
#>                1         2         3
#> colext 0.5723465 0.6403239 0.8626964
#> tPGOcc 0.5825169 0.6466030 0.8487620

Both approaches give almost the same answer: about 57% of stations occupied in the first season, rising to about 85% in the third. In tPGOcc() the rise shows as a positive season effect (0.63, with a 95% credible interval of 0.01 to 1.28). As in unmarked, altitude and rainfall have no clear effect (i.e., their 95% credible intervals overlap zero).

Like our single-season models, spOccupancy offers model goodness-of-fit tests through the ppcOcc() function that computes a posterior predictive check. We use the Freeman-Tukey fit statistic, summed by station and then by occasion:

# compare real and simulated detections, summed by station
summary(ppcOcc(rat_t, fit.stat = "freeman-tukey", group = 1))
#> Currently on time period 1 out of 3
#> Currently on time period 2 out of 3
#> Currently on time period 3 out of 3
#> 
#> Call:
#> ppcOcc(object = rat_t, fit.stat = "freeman-tukey", group = 1)
#> 
#> Samples per Chain: 15000
#> Burn-in: 5000
#> Thinning Rate: 10
#> Number of Chains: 3
#> Total Posterior Samples: 3000
#> 
#> ----------------------------------------
#>  All time periods combined
#> ----------------------------------------
#> Bayesian p-value:  2e-04 
#> 
#> ----------------------------------------
#>  Individual time periods
#> ----------------------------------------
#> Time Period 1 Bayesian p-value: 3e-04
#> Time Period 2 Bayesian p-value: 0
#> Time Period 3 Bayesian p-value: 3e-04
#> Fit statistic:  freeman-tukey

# then summed by occasion
summary(ppcOcc(rat_t, fit.stat = "freeman-tukey", group = 2))
#> Currently on time period 1 out of 3
#> Currently on time period 2 out of 3
#> Currently on time period 3 out of 3
#> 
#> Call:
#> ppcOcc(object = rat_t, fit.stat = "freeman-tukey", group = 2)
#> 
#> Samples per Chain: 15000
#> Burn-in: 5000
#> Thinning Rate: 10
#> Number of Chains: 3
#> Total Posterior Samples: 3000
#> 
#> ----------------------------------------
#>  All time periods combined
#> ----------------------------------------
#> Bayesian p-value:  0.324 
#> 
#> ----------------------------------------
#>  Individual time periods
#> ----------------------------------------
#> Time Period 1 Bayesian p-value: 0.3927
#> Time Period 2 Bayesian p-value: 0.4343
#> Time Period 3 Bayesian p-value: 0.145
#> Fit statistic:  freeman-tukey

The occasions fit (0.32), but the stations do not (a Bayesian p-value near 0): some stations detected rats on many more occasions than others, which one detection formula shared by every station cannot reproduce. colext() uses the same detection formula, so it likely misses this too. A random intercept for each station in detection, and an effect for each season, allow for it:

# make the chains repeatable
set.seed(1)
# the same occupancy formula,
rat_t2 <- tPGOcc(occ.formula = ~ scale(altitude_point) + scale(rain) + season,
                 # with detection now differing by season and among stations
                 det.formula = ~ scale(effort) + factor(season) + (1 | station),
                 # and the same data and MCMC settings
                 data = rat_sp, n.batch = 600, batch.length = 25, n.burn = 5000,
                 n.thin = 10, n.chains = 3, verbose = FALSE)
# view the results
summary(rat_t2)
#> 
#> Call:
#> tPGOcc(occ.formula = ~scale(altitude_point) + scale(rain) + season, 
#>     det.formula = ~scale(effort) + factor(season) + (1 | station), 
#>     data = rat_sp, n.batch = 600, batch.length = 25, verbose = FALSE, 
#>     n.burn = 5000, n.thin = 10, n.chains = 3)
#> 
#> Samples per Chain: 15000
#> Burn-in: 5000
#> Thinning Rate: 10
#> Number of Chains: 3
#> Total Posterior Samples: 3000
#> Run Time (min): 0.1737
#> 
#> Occurrence (logit scale): 
#>                          Mean     SD    2.5%     50%  97.5%   Rhat  ESS
#> (Intercept)            0.9768 1.3632 -1.5764  0.9221 3.7532 1.0019 2295
#> scale(altitude_point) -0.1750 0.7969 -1.8329 -0.1635 1.4002 1.0036 1959
#> scale(rain)           -0.0862 1.2922 -2.6933 -0.0114 2.3615 1.0105 1146
#> season                 1.9340 1.0239  0.2267  1.8155 4.1527 1.0025  719
#> 
#> Detection (logit scale): 
#>                    Mean     SD    2.5%     50%   97.5%   Rhat  ESS
#> (Intercept)     -1.5302 0.4778 -2.4911 -1.5256 -0.5820 1.0261  658
#> scale(effort)   -0.0152 0.1006 -0.2076 -0.0154  0.1878 1.0010 3000
#> factor(season)2  0.2102 0.2806 -0.3563  0.2077  0.7359 0.9997 2667
#> factor(season)3  1.4767 0.2768  0.9268  1.4765  2.0122 1.0018 1929
#> 
#> Detection Random Effect Variances (logit scale): 
#>           Mean    SD   2.5%    50%  97.5%   Rhat  ESS
#> station 5.0942 1.911 2.5374 4.7395 9.7398 1.0061 2494

# check the goodness of fit again, by station and then by occasion
summary(ppcOcc(rat_t2, fit.stat = "freeman-tukey", group = 1))
#> Currently on time period 1 out of 3
#> Currently on time period 2 out of 3
#> Currently on time period 3 out of 3
#> 
#> Call:
#> ppcOcc(object = rat_t2, fit.stat = "freeman-tukey", group = 1)
#> 
#> Samples per Chain: 15000
#> Burn-in: 5000
#> Thinning Rate: 10
#> Number of Chains: 3
#> Total Posterior Samples: 3000
#> 
#> ----------------------------------------
#>  All time periods combined
#> ----------------------------------------
#> Bayesian p-value:  0.1417 
#> 
#> ----------------------------------------
#>  Individual time periods
#> ----------------------------------------
#> Time Period 1 Bayesian p-value: 0.084
#> Time Period 2 Bayesian p-value: 0.109
#> Time Period 3 Bayesian p-value: 0.232
#> Fit statistic:  freeman-tukey
summary(ppcOcc(rat_t2, fit.stat = "freeman-tukey", group = 2))
#> Currently on time period 1 out of 3
#> Currently on time period 2 out of 3
#> Currently on time period 3 out of 3
#> 
#> Call:
#> ppcOcc(object = rat_t2, fit.stat = "freeman-tukey", group = 2)
#> 
#> Samples per Chain: 15000
#> Burn-in: 5000
#> Thinning Rate: 10
#> Number of Chains: 3
#> Total Posterior Samples: 3000
#> 
#> ----------------------------------------
#>  All time periods combined
#> ----------------------------------------
#> Bayesian p-value:  0.2192 
#> 
#> ----------------------------------------
#>  Individual time periods
#> ----------------------------------------
#> Time Period 1 Bayesian p-value: 0.283
#> Time Period 2 Bayesian p-value: 0.3343
#> Time Period 3 Bayesian p-value: 0.0403
#> Fit statistic:  freeman-tukey

# and compare the share of stations occupied in each season across all three models
rbind(colext = rat_colext@projected.mean["occupied", ],
      tPGOcc = apply(rat_t$psi.samples, 3, mean),
      tPGOcc_station = apply(rat_t2$psi.samples, 3, mean))
#>                        1         2         3
#> colext         0.5723465 0.6403239 0.8626964
#> tPGOcc         0.5825169 0.6466030 0.8487620
#> tPGOcc_station 0.9022285 0.9576629 0.9844329

The fit by station improves greatly, from near 0 to 0.14, though both Bayesian p-values (0.14 and 0.22) still fall below the 0.25 to 0.75 we treat as an adequate fit. Occupancy still rises across the seasons (season is 1.93, with a 95% credible interval of 0.23 to 4.15), but from a higher level: 0.90 to 0.98. Once detection can differ among stations, a station with few detections may hold rats that are simply hard to detect there, so more stations count as occupied. Every model finds the same rise; the level depends on how detection is modelled. Before trusting either level, try detection covariates that change within a season, or a random effect for each station in each season. With 28 stations, simpler models may also suit the data better.

Learn more

Session information
sessionInfo()
#> R version 4.5.1 (2025-06-13)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Tahoe 26.5.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1
#> 
#> locale:
#> [1] C.UTF-8/C.UTF-8/C.UTF-8/C/C.UTF-8/C.UTF-8
#> 
#> time zone: Australia/Brisbane
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] spOccupancy_0.8.2   unmarked_1.5.1      WildObsR_0.3.0.9000
#> [4] here_1.0.1         
#> 
#> loaded via a namespace (and not attached):
#>  [1] tidyselect_1.2.1   dplyr_1.2.1        fastmap_1.2.0      RANN_2.6.3        
#>  [5] timechange_0.4.0   lifecycle_1.0.5    sf_1.1-3           cluster_2.1.8.1   
#>  [9] ellipsis_0.3.2     terra_1.9-50       magrittr_2.0.5     compiler_4.5.1    
#> [13] rlang_1.3.0        tools_4.5.1        knitr_1.52         bit_4.6.0         
#> [17] pkgbuild_1.4.8     classInt_0.4-11    curl_8.0.0         plyr_1.8.9        
#> [21] pkgload_1.4.1      abind_1.4-8        KernSmooth_2.23-26 withr_3.0.3       
#> [25] purrr_1.2.2        desc_1.4.3         grid_4.5.1         e1071_1.7-17      
#> [29] iterators_1.0.14   MASS_7.3-65        cli_3.6.6          crayon_1.5.3      
#> [33] lutz_0.3.2         vegan_2.7-6        chron_2.3-63       reformulas_0.4.1  
#> [37] generics_0.1.4     remotes_2.5.0      otel_0.2.0         stringdist_0.9.17 
#> [41] rstudioapi_0.17.1  httr_1.4.9         tzdb_0.5.0         sessioninfo_1.2.3 
#> [45] minqa_1.2.8        DBI_1.3.0          cachem_1.1.0       proxy_0.4-29      
#> [49] stringr_1.6.0      splines_4.5.1      parallel_4.5.1     frictionless_1.3.0
#> [53] vctrs_0.7.3        devtools_2.4.6     boot_1.3-31        Matrix_1.7-3      
#> [57] jsonlite_2.0.0     mongolite_4.1.0    geojsonsf_2.0.5    hms_1.1.4         
#> [61] bit64_4.8.6        oz_1.0-22          foreach_1.5.2      tidyr_1.3.2       
#> [65] units_1.0-1        ozmaps_0.4.5       spAbundance_0.2.1  glue_1.8.1        
#> [69] nloptr_2.2.1       codetools_0.2-20   lubridate_1.9.5    stringi_1.8.9     
#> [73] lme4_1.1-37        tibble_3.3.1       pillar_1.11.1      TMB_1.9.17        
#> [77] R6_2.6.1           Rdpack_2.6.4       doParallel_1.0.17  rprojroot_2.1.1   
#> [81] vroom_1.7.1        evaluate_1.0.5     lattice_0.22-7     readr_2.2.0       
#> [85] rbibutils_2.3      memoise_2.0.1      class_7.3-23       Rcpp_1.1.2        
#> [89] coda_0.19-4.1      nlme_3.1-168       permute_0.9-10     mgcv_1.9-3        
#> [93] xfun_0.61          fs_1.6.6           usethis_3.2.1      pkgconfig_2.0.3