Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Q on occu with TMB engine for random effects

421 views
Skip to first unread message

Marc Kery

unread,
Nov 1, 2021, 4:30:41 PM11/1/21
to unmarked
Dear all,

I just wanted to try out the cool new TMB engine in unmarked to fit a static occupancy model (i.e., with function 'occu') that has a random effect of year. Mine is a small data set with 51 sites x 3 replicates and collected over 3 years. As a first attempt at a random-effects occupancy model I wanted to declare the winter as a random-effects factor in the detection model and did this:

(fmX <- occu(~ (1 | winter) ~1, data = umf)) 


R crashed on this. Did I do anything silly ? I know that a random-effects factor with only 3 levels is a bit questionable, but it should not be technically wrong to fit such a model.

Thanks and best regards -- Marc

Ken Kellner

unread,
Nov 1, 2021, 4:47:27 PM11/1/21
to unmarked
Hi Marc,

Is 'winter' defined in the siteCovs, rather than the obsCovs? There's a bug I know about where R crashes if you use a site covariate as a random effect in the detection formula. The temporary workaround would be to replicate the site covariate and put it into the obs covariates. Sorry about that.


Ken

Marc Kery

unread,
Nov 2, 2021, 4:26:57 AM11/2/21
to unmarked
Dear Ken,

fantastic, and yes, exactly. Winter is a site covariate. Creating a 'clone' in the format of an observational covariate worked like a charm.

Call:
occu(formula = ~(1 | obsWinter) ~ 1, data = umf)

Occupancy:
 Estimate    SE    z P(>|z|)
    0.482 0.323 1.49   0.136

Detection:
Random effects:
    Groups        Name Variance Std.Dev.
 obsWinter (Intercept)    0.491    0.701

Fixed effects:
 Estimate    SE    z P(>|z|)
     1.13 0.546 2.08  0.0379

AIC: 164.087

Thanks for the quick help and especially also for making the random-effects option via TMB available in unmarked ! This is really a great addition to the package.

Best regards  --- Marc












From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Ken Kellner <con...@kenkellner.com>
Sent: Monday, November 1, 2021 21:47
To: unmarked <unma...@googlegroups.com>
Subject: [unmarked] Re: Q on occu with TMB engine for random effects
 
--
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/8a8fdafa-df50-4ed2-8fba-6dbe3280facfn%40googlegroups.com.

Marc Kery

unread,
Nov 2, 2021, 4:51:28 AM11/2/21
to unmarked
Dear Ken, all,

exploring the TMB-mediated random-effects option in unmarked a little more I discovered this: apparently, as soon as we add a random-effects factor in the detection model, then ALL covariates specified in the detection model must be of the obsCov format. In my unmarked data frame, 'method' is an obsCov, 'datum' is a siteCov and 'obsDatum' is the obsCov variant of 'datum'. Here's the behaviour of unmarked for three models using these explanatory variables:

(fmX <- occu(~methode+datum-1 ~1, data = umf))  # Works 

(fmX <- occu(~methode+datum-1 + (1 | obsWinter) ~1, data = umf))

# does not work, yields the following error:

Error in model.frame.default(lme4::subbars(formula), data, na.action = stats::na.pass) :
  variable lengths differ (found for 'datum')

(fmX <- occu(~methode+obsDatum-1 + (1 | obsWinter) ~1, data = umf)) # does work


That's no big deal, but we just have to remember to create 'clones' as obsCovs for all covariates that we intend to use in the detection model when any random-effects factor is also present.

Thanks again and best regards  -- Marc


From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Marc Kery <marc...@vogelwarte.ch>
Sent: Tuesday, November 2, 2021 09:26
To: unmarked <unma...@googlegroups.com>
Subject: Re: [unmarked] Re: Q on occu with TMB engine for random effects
 

Marc Kery

unread,
Nov 2, 2021, 7:34:44 AM11/2/21
to unmarked
Dear Ken,

I am stranded when trying to form predictions for my static occupancy model which in p has one fixed-effect factor ('methode') with three levels, plus a random-effects factor ('transekt') with 49 levels. This is for a survey where a total of 180 bridges that are nested in transects were surveyed for otter sign by three types of persons ('experts', 'otterspotters', 'dog'). My fitted model is summarized as follows:
 
Call:
occu(formula = ~(methode - 1) + (1 | transekt) ~ 1, data = umf)

Occupancy:
 Estimate    SE    z P(>|z|)
    0.667 0.268 2.49  0.0128

Detection:
Random effects:
   Groups        Name Variance Std.Dev.
 transekt (Intercept)   17.944    4.236

Fixed effects:
                    Estimate   SE     z P(>|z|)
methodeexpertin        -3.91 1.34 -2.91 0.00363
methodehund            -1.77 1.21 -1.46 0.14343
methodeotterspotter    -4.48 1.38 -3.25 0.00115

AIC: 348.4884

How can I predict the fixed effects (i.e., for 'methode'), while accommodating the uncertainty due to the random transect ? I tried the following, which had worked in the model without the random transekt effects, but this now throws an error:
predict(fm5, "det", newdat = data.frame(methode = c('expertin', 'otterspotter', 'hund')))
Error in eval(predvars, data, env) : object 'transekt' not found

Adding the transect factor in the data.frame for which we predict does produce output, but returns a prediction for every single one of the 180 bridges in the data set.
predict(fm5, "det", newdat = data.frame(methode = rep(c('expertin', 'otterspotter', 'hund'), 180), transekt = umf@obsCovs$transekt[1:180]))

Thanks for your help and best regards  -- Marc

Ken Kellner

unread,
Nov 2, 2021, 11:30:21 AM11/2/21
to unmarked
Marc,

You can exclude the random effects component from the prediction by setting the argument re.form=NA:

predict(fm5, "det", newdat = data.frame(methode = c('expertin', 'otterspotter', 'hund')), re.form=NA)

However I'm not sure if this is "accommodating the uncertainty in the random transect" by your definition since the uncertainty in the random effects estimates will not be reflected in the uncertainty intervals around the predictions for each level of method. Only the uncertainty in the fixed effect parameters.

You could generate predictions for a specific transect, which is similar to what you did:

predict(fm5, "det", newdat = data.frame(methode = c('expertin', 'otterspotter', 'hund'), transkect="A"))

This at least incorporates the uncertainty in the estimate of the random effect for transect A when generating the uncertainty for the prediction. However I believe it is not accounting for uncertainty in the variance parameters. It is possible to get from TMB a full covariance matrix including all parameters (fixed and random) so perhaps I should implement some kind of bootstrapping approach to getting the CIs.

Ken

Marc Kery

unread,
Nov 2, 2021, 12:27:57 PM11/2/21
to unmarked
Dear Ken,

thanks a lot, that works fine indeed. And sorry if I have missed any documentation where this is described .... there isn't at the present moment, right ?

And yes, some method to allow for the random effects and the uncertainty about their magnitude in predictions would be great.

Best regards  --- Marc



Sent: Tuesday, November 2, 2021 16:30
To: unmarked <unma...@googlegroups.com>
Subject: [unmarked] Re: Q on predictions for occu with TMB engine for random effects
 
--
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.

Rahul Gour

unread,
Sep 13, 2024, 5:28:07 PM9/13/24
to unmarked
Dear Ken,

I hope you don’t mind me revisiting this older email chain, but I wanted to reach out because the issue I am facing looks quite similar to what has been discussed here.

I am currently working on fitting an occupancy model with a stacked design (a single-season occupancy model with a site-level random effect) using unmarked.

Would there be any documentation or guidance available that could help clarify the concepts and provide direction on how to properly structure the unmarkedFrameOccu object?

I have detection and non-detection data, with replicates for each site across two seasons (dry and wet), and my goal is to fit a model using the occu() function with random site effects. While the model runs smoothly without random effects, but I encounter errors when including the random effect.

Since I’m relatively new to unmarked, I wonder if I might be making a simple mistake in framing the object. Any advice or resources would be greatly appreciated.


## unmarkedFrame object
umf <- unmarkedFrameOccu(
  y=as.matrix(eleOcc10[,c("y1", "y2", "y3", "y4", "y5", "y6", "y7", "y8", "y9", "y10")]),
  siteCovs=eleOcc10[,c("Elevation", "WaterAv", "DistPA", "DistRH", "EVI", "CanopyHt", "siteID")],
  obsCovs=list(
    effort=eleOcc10[,c("E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "E10")],
    ruggedness=eleOcc10[,c("SL1", "SL2", "SL3", "SL4", "SL5", "SL6", "SL7", "SL8", "SL9", "SL10")],
    VegType=eleOcc10[,c("VT1", "VT2", "VT3", "VT4", "VT5", "VT6", "VT7", "VT8", "VT9", "VT10")],
    CattleGraz=eleOcc10[,c("DT1", "DT2", "DT3", "DT4", "DT5", "DT6", "DT7", "DT8", "DT9", "DT10")],
    InvCov=eleOcc10[,c("INV1", "INV2", "INV3", "INV4", "INV5", "INV6", "INV7", "INV8", "INV9", "INV10")]
  )
)

## occupancy model
ele_occ_model <- occu(~ effort + ruggedness + VegType + CattleGraz + InvCov
                                          ~ WaterAv + DistPA + DistRH + CanopyHt + EVI + (1|siteID),
                                          data = umf)

Error in optim(tmb_mod$par, fn = tmb_mod$fn, gr = tmb_mod$gr, method = method,  :
initial value in 'vmmin' is not finite



Thanks and regards,
Rahul

Ken Kellner

unread,
Sep 13, 2024, 5:29:42 PM9/13/24
to unma...@googlegroups.com
My first guess is the model is simply too complicated. Are you able to fit the model with just the random effect and no other covariates? If so I suggest using the method of slowly building up model complexity iteratively.

Ken
> > ------------------------------
> > *From:* unma...@googlegroups.com <unma...@googlegroups.com> on behalf of
> > Ken Kellner <con...@kenkellner.com>
> > *Sent:* Tuesday, November 2, 2021 16:30
> > *To:* unmarked <unma...@googlegroups.com>
> > *Subject:* [unmarked] Re: Q on predictions for occu with TMB engine for
> > <https://che01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Funmarked%2Fccd781ca-de10-4d2e-8c36-19a16b3bf2a5n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Cmarc.kery%40vogelwarte.ch%7Cb8bba8a9cb7a44b3a59b08d99e15b107%7C251ae8d19a904569a35b9d2bc41188d2%7C1%7C0%7C637714639578624014%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kAf%2BfmtpQvMtA4%2BU1h3BKkGIDBWJfw8rX%2B1i7TR6ouA%3D&reserved=0>
> > .
> >
>
> --
> *** 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/27459096-4767-4f85-b46c-908b7e44050bn%40googlegroups.com.

Marc Kery

unread,
Sep 13, 2024, 5:32:29 PM9/13/24
to unma...@googlegroups.com
Dear all,

general comment here: I think it would always be useful if people were giving a short summary of their data set. Ideally what they get by typing in R 'summary(umf)', where 'umf' is the respective unmarked data frame.

Sample size (i.e., a measure of the total amount of information available in an estimation problem) is highly relevant for whether a model is too complex or not.

Best regards  --- Marc



From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Ken Kellner <con...@kenkellner.com>
Sent: Friday, September 13, 2024 23:29
To: unma...@googlegroups.com <unma...@googlegroups.com>
Subject: Re: [unmarked] Re: Q on predictions for occu with TMB engine for random effects
 

> > .
> >
>
> --
> *** 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/27459096-4767-4f85-b46c-908b7e44050bn%40googlegroups.com.

--
*** 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.

Rahul G

unread,
Sep 14, 2024, 3:56:37 AM9/14/24
to unma...@googlegroups.com
Dear group users,

I’ve also attempted to minimize the NA values in the unmarkedFrame object and checked for multicollinearity, as that could potentially be the issue. However, I’m still encountering the error when using the random effect (1|siteID). As mentioned earlier, the model runs smoothly without the random effect.

## VIF with a linear model
lm_model <- lm(rep(1, nrow(eleOcc10)) ~ WaterAv + DistPA + DistRH + CanopyHt + EVI, data = eleOcc10)

vif(lm_model)
> WaterAv    DistPA    DistRH   CanopyHt      EVI
  1.201701  1.080765  1.364489  1.200833    1.070045 



## fitting model
ele_occ_model <- occu(~ effort + ruggedness + VegType + CattleGraz + InvCov
                                          ~ WaterAv + DistPA + DistRH + CanopyHt + EVI + (1|siteID),
                                          data = umf)
> Error in solve.default(full) :
  Lapack routine dgesv: system is exactly singular: U[177,177] = 0


Thanks, 
Rahul

--
*** 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.

Rahul G

unread,
Sep 14, 2024, 4:12:32 AM9/14/24
to unma...@googlegroups.com
Dear Ken,

Thank you for your email, I have tried fitting the mode, just with random effect and no other covariates, it worked without an error, as you said too many covariates complicating it, I will do as you suggested by building the model complexity iteratively. Thanks a ton.

Dear Marc,

I am really sorry for not providing the summary for the data set.

Screenshot 2024-09-14 at 13.31.48.png

Regards,
Rahul

Marc Kery

unread,
Sep 14, 2024, 3:12:31 PM9/14/24
to unma...@googlegroups.com
Dear Rahul,

do I understand right: you want to fit a static occupancy model with site random effects in occupancy ? That model is not identiable. In a static occupancy model, one can estimate random site effect for detection, but not for occupancy.

Best regards  ---- Marc


From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Rahul G <rahul...@gmail.com>
Sent: Saturday, September 14, 2024 09:56
To: unma...@googlegroups.com <unma...@googlegroups.com>
Subject: Re: [unmarked] Re: Q on predictions for occu with TMB engine for random effects
 

Rahul G

unread,
Sep 15, 2024, 3:03:04 AM9/15/24
to unma...@googlegroups.com
Thank You Marc for your insight.

I was under the assumption that random effects can model site-level variability in the probability of occupancy as well - capturing unobserved factors that might influence whether a species is present at a site.

For example, two sites may have similar observable environmental covariates (e.g., elevation, habitat quality), but due to unmeasured factors (like subtle microclimates or season in my case), their actual occupancy probabilities may differ. A random site-level effect can help account for this extra variability in occupancy.

Regards,
Rahul

gcsadoti

unread,
Sep 16, 2024, 7:19:27 AM9/16/24
to unmarked
Hi Rahul,   

Independent of whether occu can accommodate random effects on occupancy, I encourage you to think about what a random effect of siteID means here. As each site is only represented by a single "observation" in the static occupancy model you've attempted, a random effect at the site level (i.e., (1|siteID)) amounts to an observation-level random effect (one level of the random effect per row [siteID in this example]). Observation-level random effects have been used in GLMMs when overdispersion (e.g., in count data) is present, but other than that (and perhaps other contexts of which I'm ignorant) they don't make much sense. If you haven't looked, there are some good discussions among those in the mixed-effects ecological modeling community if you search for "observation-level random effects"

Cheers,
Giancarlo

Marc Kery

unread,
Sep 16, 2024, 7:31:57 AM9/16/24
to unmarked
Dear Rahul

in a static occupancy model, random site effects in occupancy are simply not estimable. Attached is a little simulation that shows this by repeatedly simulating data where there are such random effects, and then fitting a model that tries to estimate them. As you can see in the attached graph (which also shows the estimates of the occupancy and the detection intercepts), there is no relationship at all between the known true value of the occupancy site-effects SD and the corresponding estimates. Therefore, we can conclude that this parameter is not estimable.

This fact is related to the inability of estimating an overdispersion parameter in a random-effects logistic regression (i.e., a traditional GLMM) when the response is binary. Overdispersion there can only be estimated when the response is a proper count with some/lots of values greater than 1.

(In the attached code I also tried to run the analogous simulation for the other case, when we have random site effects in detection. This model is estimable. However, for some reason R just shuts down when I want to fit this model. Once Ken explains to me what I am doing wrong, I will complete and send out again.)

Best regards  – Marc




From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of gcsadoti <gcsa...@gmail.com>
Sent: Monday, September 16, 2024 13:19
To: unmarked <unma...@googlegroups.com>
Random site effects not estimable in static occupancy model.pdf
Simulation is the answer.R

Quresh Latif

unread,
Sep 16, 2024, 9:28:05 AM9/16/24
to unma...@googlegroups.com
Even if it is possible, is it really advisable to have a site-level random effect on detectability? It seems like that would soak up a lot of the variation in the data, leaving very little left over for estimating patterns in occupancy, which is usually what we care about. Also, it is my understanding that if you have a factor that actually affects occupancy but you include it only as an effect on detectability, you can get pretty biased estimates. Considering that you can't put a site level random effect on occupancy, it seems like it would be a bad idea to do so for detectability as well.

Quresh S. Latif
Biometrician
Bird Conservancy of the Rockies
230 Cherry St., Ste. 150, Fort Collins, CO 80521
970-482-1707 (ext. 15)
Connecting people, birds and land


--
*** 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.
--
*** 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.
--
*** 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.
--
*** 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.

--
*** 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.

Marc Kery

unread,
Sep 16, 2024, 9:29:21 AM9/16/24
to unma...@googlegroups.com
Good points ..... and here's another simulation study waiting to be done 😉



From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Quresh Latif <quresh...@birdconservancy.org>
Sent: Monday, September 16, 2024 15:27

Rahul G

unread,
Sep 17, 2024, 6:25:05 AM9/17/24
to unma...@googlegroups.com
Dear Marc

Thank you very much, for your thorough explanation and for clarifying the case using the simulation results. 
I now better understand why estimating random effects for a static occupancy model is problematic, as the model struggles to correctly estimate site-level variability in occupancy, even under best-case conditions.

However, I’m still grappling with why using a random effect for a static model specifically poses these challenges, and I would appreciate any additional insights into this.

Given that I have detection /non detection data from two distinct seasons (Dry and Wet), I am particularly interested in estimating the variability in occupancy across sites for each season. I believe occupancy of elephants changes spatially across the landscape for each season, and If possible I would like to incorporate this seasonal variability into the model.

Could you please advise on the best way to handle this situation? For example, should I consider modeling each season separately as independent static models and then compare the results spatially across seasons?

Your insights would be greatly appreciated in helping me navigate this aspect of the analysis.

Thanks and regards,
Rahul

Marc Kery

unread,
Sep 17, 2024, 12:33:40 PM9/17/24
to unma...@googlegroups.com
Dear Rahul,

estimating random site effects in occupancy in the simplest situation (i.e., in one period of closure) is not problematic, but is impossible in principle.

I am not totally sure I understand what you mean.

You seem to have two periods of closure.... dry and wet. So, your case is more information-rich than the one that I simulated. And it may just be that a site random effects factor in occupancy becomes identifiable in that case ---- however, without running a simulation I'd strongly advise against that.

Re 'occupancy of elephants changes spatially across the landscape for each season', well, it seems to me that this will be taken account of by simply running a stacked-data analysis and fitting an effect of the binary factor 'season'.

OK, and now I see how random site effects in occupancy may come into play .... to accommodate any non-independence of the occurrence at each site across multiple seasons, one should add site as a random-effects factor. To avoid pseudoreplication, in the old verbiage of Hurlbert (1984). OK, so perhaps in your case I might also fit random site effects in occupancy. But be warned that you will still be in a marginal-information situation, and numerical estimation may fail and you get an estimate of the site random effects variance of 0.

Best regards  --- Marc


From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Rahul G <rahul...@gmail.com>
Sent: Tuesday, September 17, 2024 12:24

Rahul G

unread,
Sep 18, 2024, 10:49:20 AM9/18/24
to unma...@googlegroups.com
Thank you, Marc and others, for the valuable insights and all the responses! 
After these discussions over here and some additional reading, I think I’ve got some plan in place. I’ll give it a shot now.

Kind regards,
Rahul

Reply all
Reply to author
Forward
0 new messages