I get the feeling this is probably pretty easy and straight forward. But, I’m new to unmarked, and fairly new to R as well. I’m analysing occupancy (occupancy and detection probability) for introduced rats on islands in an archipelago in the tropical Pacific using ‘occu’. I have two replicates of 100 samples each, collected at 50 sample stations on tourist visited islands and 50 on non-tourist visited islands. My covariate (‘siteCovs’) is thus “tourist”. All went smoothly until I tried to backTransform occupancy (‘state’ variable) in my model with the covariate (as I’d read would happen). However, I’m not entirely sure how to use the linearComb feature to produce as “scalar linear combination” that I can then backTransform. Here is what it looks like (please forgive the sloppiness - I copied and pasted from history in R Studio):
Call:
occu(formula = ~1 ~ Tourist, data = umf)
Occupancy:
Estimate SE z P(>|z|)
(Intercept) 0.984 0.344 2.863 0.00419
Tourist 9.640 41.505 0.232 0.81633
Detection:
Estimate SE z P(>|z|)
1.41 0.207 6.85 7.56e-12
AIC: 226.0303
> backTransform(fm2['det'])
Backtransformed linear combination(s) of Detection estimate(s)
Estimate SE LinComb (Intercept)
0.804 0.0325 1.41 1
Transformation: logistic
> backTransform(fm2['state'])
Error in .local(obj, ...) :
Cannot directly back-transform an unmarkedEstimate with length > 1.
Use linearComb() and then backTransform() the resulting scalar linear combination.I tried to take a stab at this, based on material I had read and seen online, but I'm not sure this is correct:
> lcfm2 <- linearComb(fm2, c(1,1), type='state') > lcfm2 Linear combination(s) of Occupancy estimate(s) Estimate SE (Intercept) Tourist 10.6 41.5 1 1 > backTransform(lcfm2) Backtransformed linear combination(s) of Occupancy estimate(s) Estimate SE LinComb (Intercept) Tourist 1 0.00101 10.6 1 1 Transformation: logistic
Am I close??? Thanks for any and all help, and your patience...
Paul Radley
# Fit model p(time+wind), psi(hab)
summary(fm2.occ <- occu(~time+wind-1 ~hab, data=umf))
# Predict occupancy for habitat factor levels
newdat <- data.frame(hab = c("A", "B", "C"))
predict(fm2.occ, type="state", newdata = newdat, appendData = TRUE)
> newData <- data.frame(Tourist=0:1) > round(predict(fm2, type='det', newdata=newData, appendData=TRUE), 2) Predicted SE lower upper Tourist 1 0.52 0.05 0.41 0.62 0 2 0.89 0.03 0.80 0.94 1 > predict(fms, type='det', newdata=newData) Predicted SE lower upper 1 0.5191853 0.05424816 0.4135946 0.6230897 2 0.8896665 0.03414701 0.8030614 0.9409851