Dear all,
I am playing around with some multi-season occupancy models in Unmarked, but I have this issue. If I used two years (seasons or primary period), when I try to add “year-1” in the colonization and extinction part of the model it does not work, and I received this message.
m2 <- colext(~1, ~year-1, ~1, ~1, umf)
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels
I tried exactly the same code but added two fake years more to test the script. So, I used a detection history across four years and all models ran well, including the derived parameters for the projected psi per year.
Is it correct to think that these models only apply to situations where we have more than two years or what can I do to include the year in the col and extinction parameters? (please see below how I added year as a covariate in case it´s wrong)
If I used a model with a covariate only
in the initial occ such as m12 <-colext(~Dist.Ele,~1,~1,~1,umf), I
can get the col/ext estimates for the first year (and the two years for
p) and also the derived estimated occupancy probability for smoothed and
projected for each year with their SE (which is actually our primary interest for now). I am
just confused about why we can not add the year directly in the col(gamma) and
ext(epsilon) part when we have two years (probably more a conceptual question).
Any insight would be highly appreciated.
thanks
All the best
L
--------
A bit of extra context
I created the year cov like this, hope is fine
n <- nrow(sp_DH1) # number of sites, sp_DH_1 is the detection history df
T <- 2 # number of primary periods, years or seasons
J <- 21 # number of secondary periods (visits per season)
y <- as.matrix(sp_DH1)
# create a matrix indicating the year each site was surveyed.
year <- matrix(c('1','2'), nrow(y), T, byrow=TRUE)
umf <- unmarkedMultFrame( y = y,
numPrimary = 2, siteCovs = site_covs_s[,11:12], yearlySiteCovs = list(year = year))
Postdoctoral Research Fellow
Wildlife Ecology Lab,
School of Natural Resource Management
Nelson Mandela University
George Campus, South Africa
Mobile: +27-0762599325
Colombia: +57-3112538652 (WhatsApp)
--
*** 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 on the web visit https://groups.google.com/d/msgid/unmarked/d2c7b9d7-c243-4ecc-a7d1-5a243514f63dn%40googlegroups.com.