Open klg-2016 opened 1 year ago
I don't know that you necessarily need to include these but all of the ones you just named should be publicly available online! (Again, you may not need to use them.)
I doubt they are in the likelihood function. They'd be covariates in a model, but there's a decent chance they aren't actually using them.
My understanding is that the likelihood script creates (not sure if that's the right word here) the function that the whole thing is trying to optimize (mmpp_covs), which is what made me think it might be in there. But I'm looking through 02_fit_model.R and lines 174-180 create a site_covs tibble--does that look like where they pulll in covariates?
site_covs <- data.frame(deployment_id=deps) %>% #KLG: 1945 deployments
left_join(dep_to_site) %>% #KLG: add sites for each deployment
select(deployment_id, title) %>% #KLG: select these columns
rename(Camsite=title) %>%
left_join(covs[,c(1:20)]) %>% #KLG: add covariates (I thought you usually needed a by = argument)
select(Camsite, deployment_id, Dist_5km, HDens_250m, Hunting) %>%
as_tibble()
in which case, do they seemingly not use any of the daily covariates? site_covs also gets called in lines 222-224 of the same script.
X_f1 <- model.matrix(~Hunting, site_covs)
X_f2 <- model.matrix(~Hunting, site_covs)
X_f12 <- model.matrix(~Hunting, site_covs)
Sorry that references the code in a messy way
Based on these lines, it doesn't seem like any covariates make it into the likelihood function (not included in the arguments):
And based on the lines you shared, those are just site-level covariates. I'm not sure if detection-level covariates are included anywhere—was this mentioned in the paper?
let me go back and check. also do you have suggestions for where to start looking if I decide I do want those daily covariates for GNP?
Wait, that was the likelihood function in R, not the one in C++ (mmpp_covs). I... don't understand what is going on here.
I would honestly just start by googling things like "get moon phase for given location and day in R." For things like precipitation maybe the best thing to do is e-mail Miguel. But this is expanding the scope quite a bit!
do you have any concept of how the two scripts for likelihood (the one in R and the one in C++) relate to each other? are they just different ways of writing the same thing, or are they actually different things? I also have no idea what's going on in those lines you referenced. I just skimmed back through the paper and it doesn't seem like they used the daily covariates at all. I see hunting (yes/no) and then the Fourier series stuff relating to time of day. I think the Parsons paper that uses this model did use precipitation at least. I'm very happy to start without daily covariates and think about those more later.
Also, Charlie (puppy) is antsy because he hasn't gotten a walk yet today so I'm going to go out and do that and come back to this later.
Yeah ignore daily covs!!
the one in R is creating a function called mmpp and the one in C++ is creating a function called mmpp_covs, which seems to be the one that is actually used... no other insights from me there tho...
https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/77fd055142e3cce389ea8f75d1bbda9bd17a282d/occupancy-mmpp-master/application/01_format_data_meso.R#L90
Their covariates include daily values for a ton of different variables (day of the year, day/week of the year, moon phase, NDVI, precipitation, etc). I have two questions related to this: do you know which of these I might have access to for GNP? also, I'm not sure how to figure out where in their code they use these variables, if at all. If it's in the likelihood script, that's currently basically a black box to me. I'll keep thinking on these questions, but I wanted to see if you have any thoughts