Back transforming beta estimates of colext "Multi-season dynamic occupancy models"

278 views
Skip to first unread message

Edward Raynor

unread,
Sep 18, 2015, 4:34:37 PM9/18/15
to unmarked
Hello,
I am trying to use Multi-season (4 years x 2 visits per year of 9 sites) dynamic occupancy model 'function colext' to determine occupancy of certain avian guilds(n=3) in certain treatments(n=3) and I'm having trouble getting the non-logit scale estimates of occupancy for each categorical guild per treatment (Perching*Treatment):
(fm18 <- colext(psiformula = ~ Treatment*Perching,
                gammaformula = ~ Treatment,
                epsilonformula = ~ Treatment*Perching,
                pformula = ~ Treatment*Perching, umf, control = list(trace=1, maxit=1e4)))

using

newData <- data.frame(Perching=c("Per.1", "Per.2", "Per.3"))
round(predict(fm19,type='state', newdata=newData, appendData=TRUE),2)

Error in nrow(X) : object 'X' not found


I could not get the backTransform function to work either.
Species replace sites in this analysis so 36 species x 9 sites x 8 visits =2592 rows in long form converted to unmarkedMultFrame.

Are examples available  of how to write this backTransform code with interacting categorical variables?
Edward

Kery Marc

unread,
Sep 18, 2015, 5:20:22 PM9/18/15
to unma...@googlegroups.com
Dear Edward,

one possibility might be to define a single factor for the Treatment/Perching interaction. That factor would have 9 levels (3 x 3). Then, you use predict() with that factor and that should give you the predictions of occupancy probability for every combination of Treatment and Perching: that is what the interaction means.

Best regards  --  Marc


--
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.
For more options, visit https://groups.google.com/d/optout.

Edward Raynor

unread,
Sep 20, 2015, 8:19:49 PM9/20/15
to unmarked
Thank you for the quick response!

I used this code to arrive at the estimates for level 1 with these results:
newData <- data.frame(TreatPerch=factor("1",levels=c("1","2","3","4","5","6","7","8","9"))) 
> round(predict(fm18,type='psi', newdata=newData, appendData=TRUE))
Error in Math.data.frame(list(Predicted = 0.523532688288911, SE = 0.136592586767124,  : 
  non-numeric variable in data frame: TreatPerch

The estimate and SE look like what I want but I'd prefer to also have the 95%CI too,; however, why the error?

Edward

Edward Raynor

unread,
Sep 20, 2015, 8:47:16 PM9/20/15
to unmarked
I didn't need that round finction:
predict(fm18,type='psi', newdata=newData, appendData=TRUE)
  Predicted         SE       lower     upper TreatPerch
1 0.5235327 0.13659259 0.273081666 0.7626827          1
2 0.1732246 0.06220991 0.082088861 0.3292478          2
3 0.4617602 0.07803013 0.316781447 0.6135089          3
4 0.3382145 0.13413830 0.136359100 0.6232445          4
5 0.2228748 0.06550665 0.120228259 0.3757299          5
6 0.6170045 0.08266704 0.447991155 0.7617861          6
7 0.1118651 0.13283487 0.009081945 0.6338303          7
8 0.5070416 0.11275134 0.298183796 0.7134701          8
9 0.4147310 0.08211939 0.267463413 0.5789946          9

Thanks for the help. I'm assuming these are the numbers that I report for the probability of occupancy of these groups as they are now no long on the logit-scale?

Kery Marc

unread,
Sep 21, 2015, 4:50:37 AM9/21/15
to unma...@googlegroups.com
Dear Edward,

glad it worked and you get everything you need thrown at you by unmarked.

BTW, I think it must be possible to get these predictions also from the original model that you fit, using some code like this:

newData <- data.frame(Treat=factor(c("1", "1", "1", "2", "2", "2", "3", "3", "3"), levels=c("1","2","3"),
   
Perch=factor(c("1", "2", "3", "1", "2", "3", "1", "2", "3"), levels=c("1","2","3"))
predict(fm18,type='psi', newdata=newData, appendData=TRUE)

Kind regards  -- Marc

Edward Raynor

unread,
Sep 23, 2015, 4:39:29 PM9/23/15
to unmarked
Thank you for the quick response! I'm trying to go a step further and look at occupancy at equilibrium (p. 208, MaKenzie et al.book on Occupancy models) of each of these guilds in each of these treatments. Occupancy at equilibrium = colonization/(colonization+Extinction). I've been told I can get the SE for these estimates using the Delta method because I have the SE for colonization and extinction from the predict function. Is there a resource available with an example?

Edward Raynor

unread,
Sep 23, 2015, 8:43:24 PM9/23/15
to unmarked
Disregard, I figured it out using calculus!
Reply all
Reply to author
Forward
0 new messages