Re: [unmarked] Beta and predict occupancy differents

104 views
Skip to first unread message
Message has been deleted

Ken Kellner

unread,
Aug 2, 2022, 6:36:37 PM8/2/22
to unma...@googlegroups.com
It's hard to help without knowing the inputs to predict(). Can you show the code you used for that part?

Ken

On Tue, Aug 02, 2022 at 02:35:46PM -0700, Larissa Fornitano wrote:
> Hi group! I'm using occuMulti to estimate co-occurrence between two
> species. The estimated beta in the model is positive but when I calculate
> the predict the occupancy values are decreasing. What could be wrong??
>
>
> Call:
> occuMulti(detformulas = c("~effort", "~1"), stateformulas = c("~1",
> "~pastin", "~pastin"), data = msom_data, maxOrder = 2)
>
> Occupancy:
> Estimate SE z P(>|z|)
> [dog] (Intercept) -0.565 0.605 -0.934 0.3502
> [puma] (Intercept) -0.361 1.082 -0.334 0.7386
> [puma] pastin -3.030 1.652 -1.834 0.0667
> [dog:puma] (Intercept) 0.738 1.235 0.598 0.5499
> [dog:puma] pastin 2.867 1.566 1.831 0.0671
>
> Detection:
> Estimate SE z P(>|z|)
> [dog] (Intercept) -1.277 0.158 -8.06 7.63e-16
> [dog] effort -0.237 0.169 -1.41 1.59e-01
> [puma] (Intercept) -2.472 0.258 -9.59 8.46e-22
>
> AIC: 632.2294
>
>
>
>
> Predicted SE lower upper
> 1 0.6183253 0.2143760 0.15262122 0.8961442
> 2 0.6166267 0.2122266 0.15763407 0.8934169
> 3 0.6149253 0.2100930 0.16280296 0.8906263
> 4 0.6132211 0.2079797 0.16813069 0.8877712
> 5 0.6115141 0.2058913 0.17361989 0.8848508
> 6 0.6098044 0.2038326 0.17927297 0.8818640
> 7 0.6080919 0.2018088 0.18509214 0.8788099
> 8 0.6063768 0.1998251 0.19107935 0.8756873
> 9 0.6046591 0.1978870 0.19723624 0.8727667
> 10 0.6029388 0.1960001 0.20356418 0.8709269
> 11 0.6012159 0.1941702 0.21006420 0.8691813
> 12 0.5994905 0.1924030 0.21673695 0.8674346
> 13 0.5977627 0.1907043 0.22358272 0.8656482
> 14 0.5960324 0.1890801 0.23060136 0.8638218
> 15 0.5942997 0.1875361 0.23706972 0.8619547
> 16 0.5925647 0.1860779 0.24351708 0.8608038
> 17 0.5908274 0.1847110 0.24765937 0.8601451
> 18 0.5890878 0.1834406 0.25170542 0.8593257
> 19 0.5873459 0.1822718 0.25579666 0.8563462
> 20 0.5856019 0.1812092 0.25958977 0.8532949
>
> --
> *** 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/5b574682-adb3-4bf2-bd64-06d491cf735bn%40googlegroups.com.

Larissa Fornitano

unread,
Aug 2, 2022, 6:42:35 PM8/2/22
to unmarked
pastin2 <- occuMulti(detformulas = c('~effort', '~1'),  ##de acordo com o numero de especies

                    stateformulas = c('~1',
                                      '~pastin', '~pastin'),  ##um pra cada espécie + um pra cada par de combinação
                    maxOrder = 2,
                    data = msom_data)

nd_cond <- data.frame(pastin = seq(min(occ_covs$pastin), max(occ_covs$pastin),
                                    length.out = 100))

dog_puma2 <- predict(pastin2, type= 'state', species='puma',
                       cond='dog', newdata= nd_cond)

dog_puma <- predict(pastin2, type= 'state', species='puma',
                      cond='-dog', newdata= nd_cond)

Ken Kellner

unread,
Aug 2, 2022, 7:30:56 PM8/2/22
to unma...@googlegroups.com
The key thing in your output is that while the 'pastin' covariate has a positive effect on the interaction term [dog:puma] it has a larger negative effect on puma occupancy on its own [puma]. Both of these parameters influence the conditional occupancy probability calculation, and in this case the net result is that the negative effect of pastin on puma by itself outweighs the positive effect on the interaction term resulting in the pattern you observe. In terms of actually interpreting this biologically I'd say that 'pastin' has a negative effect on puma occupancy, but this relationship is not as strong (though still overall slightly negative) when dogs are present.

This can be unintuitive so it helps to actually see the calculation for conditional occupancy. Below, using your parameter estimates, and I show the manual calculation in R of puma occupancy conditional on dog presence for two possible values of the pastin covariate - low (-1) and high (1).

# Step 1 - calculate the natural parameters (f)

# when covariate value is low (say -1)
f1 <- -0.565 # dog
f2 <- -0.361 + -3.030 * (-1) # puma
f3 <- 0.738 + 2.867 * (-1) # interaction

# Step 2
# To calculate puma occupancy conditional on dog presence, we need the probability of two occupancy states:

# Probability of state [11] where both species are present
# See eqn 2-4 of Rota et al. 2016
# notice that both f2 (where pastin has a negative effect) and f3 (where pastin has a positive effect)
# are included in this calculation
psi11 <- exp(f1+f2+f3)/(1+exp(f1)+exp(f2)+exp(f1+f2+f3))

# Probability of state [10] where dog is present but puma is absent
# again, both f2 and f3 are included
psi10 <- exp(f1)/(1+exp(f1)+exp(f2)+exp(f1+f2+f3))

# Step 3 calculate conditional occupancy
# occupancy species 2 conditional on species 1, when covariate value is low
psi_cond_low <- psi11 / (psi10+psi11) # similar to Rota et al. 2016 eqn 4

# Now, repeat this process again when covariate value is greater (=1)

# calculate f
f1 <- -0.565
f2 <- -0.361 + -3.030 * (1)
f3 <- 0.738 + 2.867 * (1)

# occupancy prob both species 1 and 2
psi11 <- exp(f1+f2+f3)/(1+exp(f1)+exp(f2)+exp(f1+f2+f3))
# occupancy only species 1
psi10 <- exp(f1)/(1+exp(f1)+exp(f2)+exp(f1+f2+f3))

# occupancy prob species 2 conditional on species 1 presence
psi_cond_high <- psi11 / (psi10+psi11)

# Compare conditional occupancy
psi_cond_low # 0.63181
psi_cond_high # 0.55329

Note that as with your results, in this example, puma occupancy conditional on dog presence is higher when the covariate has a value of -1 vs. when the covariate has a value of 1.

Ken
> To view this discussion on the web visit https://groups.google.com/d/msgid/unmarked/585c4bd9-5def-4862-bb47-a75840827307n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages