Closed klg-2016 closed 4 years ago
Have a look at what I just did (you were missing the ~ in the model formula)
I'm getting a new error, though, because you need 15 formulas and you only have 10
Oh it's because you need to specify that you should ignore the higher-order effects in the occuMulti function, not the unmarkedFrameOccuMulti function
Alas, now we hit the error with the NAs
Missing detections at sites: 11, 12, 21, 23, 25, 47, 49, 52, 56
Anyway just be sure to pull my changes! It should work as long as we figure out those pesky NAs :(
Okay! So next step is cutting the NAs for those cameras. You recommended a for loop to do that?
Also I think in the unmarkedFrameOccuMulti function, maxOrder restricts which species combos make it into the data object (so not necessary but I put it back in)
Well I don't know if that is going to work either, because you'll end up with that "ragged indexing" problem I think (it seems like even the cameras that have NAs at the end (not just in the middle) are also coming up in that list of missing detections, right?
Okay! So next step is cutting the NAs for those cameras. You recommended a for loop to do that?
Also I think in the unmarkedFrameOccuMulti function, maxOrder restricts which species combos make it into the data object (so not necessary but I put it back in)
That's interesting, because when I ran it with that argument in there, it gave me an error and didn't work!
Error in unmarkedFrameOccuMulti(y = y, siteCovs = occ_covs, maxOrder = 2) : unused argument (maxOrder = 2)
Hmmm yeah you're right for the NAs at the end. I hadn't noticed that. I didn't follow what the Rota code did to address that but I'll take another look and see if we can apply it.
That's weird! When I run it with that argument, the data object only includes species pairs. When I run it without, it includes up to trios/all 4 species.
do you think it might be as simple as this? (from Rota's formatting data R script)
start <- 1 for(i in 2:nrow(bobcat)){ start <- c(start, sum(cday[1:(i - 1)]) + 1) }
Also I know you've got to head out soon, can you give me a head's up when you do (if you haven't already)? just for me to organize my evening.
Yeah I probably can't work on this any more today, sorry! I don't know if this workaround thing will work, sorry... can come back to it tomorrow
Sounds good! I'll spend some time with it tonight and see what I can figure out. Thank you for your help today :) and I hope tomorrow goes well!
Thanks—great progress today!!
On Tue, Jul 28, 2020 at 4:50 PM klg-2016 notifications@github.com wrote:
Sounds good! I'll spend some time with it tonight and see what I can figure out. Thank you for your help today :) and I hope tomorrow goes well!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/59#issuecomment-665351425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WTYYQOG6RP2I7DQPZB3R55P4NANCNFSM4PLABLQA .
-- Kaitlyn Gaynor Postdoctoral researcher National Center for Ecological Analysis and Synthesis University of California - Santa Barbara
Thank you! Quick update (for when you return to this, not tonight): it's unsurprisingly not that easy a fix, the code I copied just creates an object (start) for use in the stan code. So I'm going to keep thinking about it.
Alas, now we hit the error with the NAs
Missing detections at sites: 11, 12, 21, 23, 25, 47, 49, 52, 56
I'm actually not 100% convinced this is a problem.
The model, even with those missing values, seems to run just fine and produces intercept values and for occupancy and detection covariates, and an AIC number. My brother directed me toward a google group for this package (https://groups.google.com/forum/#!forum/unmarked), so I'm going to check it out and see if anyone's had this issue.
There's a new error, though, when you try to plot it (last picture): it complains again about needing 15 formulas, so I'll see what happens when I remove maxOrder from the data function again
from Peter, who's checking out the unmarked source code for me: I'm like 90% sure it will handle missing data appropriately And it looks like it will give a different error message if it's missing too much
regarding the error message when trying to plot(fit):
I might leave it here for the night but wanted to note what I've tried
Closing issue; we addressed the main question, I started a new issue for plotting
https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/dafa0dea27fe0b6db847a5254160c9672feeef6a/scripts/GNP-models.Rmd#L64
I think that which covariates are considered in each of these goes based on the name of the column in the covariate table (in Rota_fit_R, they named the columns occ_cov1:occ_cov8 or whatever, and then used those). I tried to do the same here, but when I run occuMulti below, the following error message comes up: Error in eval(parse(text = x, keep.source = FALSE)[[1L]]) : object 'tree_hansen' not found
Any thoughts?