kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

understanding how the different types of variables are assigned #99

Open klg-2016 opened 3 years ago

klg-2016 commented 3 years ago

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/91d55f0948657549a9f2f77570bf1fb5a8165d79/scripts/multi-season%20model/multi-season-sample.Rmd#L73

okay so the siteCovs are "Data frame of covariates that vary at the site level." In this example, they're set to the second and third columns of crossbill, which correspond to elevation and forest cover. Does that mean that they're saying those two covariates are constant for a given site across the 9 years of surveys? I thought that the number of surveys would also be a site covariate?

yearlySiteCovs are "Data frame containing covariates at the site-year level." So these are things that will vary by year and by site--could change from year to year at a given site, and different among sites? In this example they're set just to be the list of years (1999-2007), which I don't understand why.

obsCovs are "Data frame of covariates that vary within site-year-observation level." This means something that varies by year and site, and could vary within a year at a given site? In this example they're set as the dates of each survey, which would change by year at a given site, and there's more than one date at a given site in a given year? Is that right?

kaitlyngaynor commented 3 years ago

I think you're right about siteCovs—they would be consistent for a site across the entire study period (this would be things like tree cover, distance to lake... I guess technically fire frequency SHOULD be recalculated each year with a rolling window, but for now, we could treat as static)

And yes, I think you're right about yearlySiteCovs, that they vary across sites AND years.

obsCovs vary within a year, and are assigned for each sampling unit (in this case, a day). Could be something like moon phase. I don't think we need to worry about these.

I was just having a look at Kendall's code (unfortunately his repo is private or I'd share) and it actually doesn't look like he has "fire" in there as a covariate or anything. He is just using siteCovs to model extinction/colonization probabilities, rather than yearlySiteCovs, and I guess he is looking at whether the year of the fire led to changes in extinction/colonization? But it does seem like you can look at yearlySiteCovs too. From colext function description:

The colonization and extinction rates can be modeled with covariates that vary yearly at each site using a logit link. These covariates are supplied by special unmarkedMultFrame yearlySiteCovs slot. These parameters are specified using the gammaformula and epsilonformula arguments. The initial probability of occupancy is modeled by covariates specified in the psiformula.

In this case, I might assign "wild dog presence" and "lion activity" to be 0 and 1 at each camera, where wild dog is basically 0 until the year that they were reintroduced, and then becomes 1 in areas where they were active (0 in areas where the remained absent), using Meredith's rough 0/1 classification of wild dog activity that she's done for her other paper.

Where is the multi-season-sample.Rmd code coming from? Sorry if it's linked somewhere else, I'm kind of dipping my toes in here & there. I'm also confused about why year is in yearlySiteCovs

klg-2016 commented 3 years ago

The sample code is from the colext pdf Kendall shared with us--also here: https://cran.r-project.org/web/packages/unmarked/vignettes/colext.pdf.

Okay. I think I follow what you're saying, I am close to winding down here tonight and will come back to it tomorrow.

Does Kendall not use the yearlySiteCovs variable at all? Or does he also use year?

kaitlyngaynor commented 3 years ago

I do think we need to use year, upon further inspection. See other comment I just left here: https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/101#issuecomment-747889614

Not sure if Kendall uses it, though. He has a few different scripts so I'm trying to figure out what's going on, exactly.

Sorry I'm not doing this as systematically as I had hoped, haha, kind of bouncing between your e-mail, your scripts, the issues, and other scripts when I can find time. Will keep poking at it. I should be a lot more responsive over the next few weeks, even if I don't have huge amounts of time to dedicate to it (fewer pressing deadlines)

klg-2016 commented 3 years ago

Sounds good, thank you! I'll poke through Kendall's work as well and see what I can figure out. I'm entering winter break (after today) with more family stuff going on over the next bit of time, but I will continue working on this as well!

kaitlyngaynor commented 3 years ago

Sounds good. Sorry I wasn't as much help as I'd hoped to be. Will look at the code & issues a bit more today!

klg-2016 commented 3 years ago

Thank you! :)

klg-2016 commented 3 years ago

This is from Kendall's README:

Using this framework, I'm planning to assign the fire covariates of interest (soil severity, distance to burn edge, change in canopy cover over time, and burn/no burn) to the Colonization and Extinction variables to see how these change the probability of a given species persisting in occurence after fire.

That suggests that he is planning to use the fire variables as a covariate, at least at some point, right? (I haven't gotten to the actual code yet, I figured I'd start with the readme)

kaitlyngaynor commented 3 years ago

Yes, this makes sense to me! I'd think these would be yearlySiteCovs once he incorporates them.

klg-2016 commented 3 years ago

okay--so I'll work through the code but the incorporation of those variables might just not be there yet. Thanks!

kaitlyngaynor commented 3 years ago

Yeah, his most recent update was days ago so I think it's very much a work in progress, and there seem to be several different scripts where he's trying out different things. I wouldn't get too in the weeds, but just have a peek. We can always ask him for more insights. He'd probably be willing to jump on a quick call with the three of us (probably in the new year) to talk through this modeling. That may be the most efficient step if you feel really stuck.

klg-2016 commented 3 years ago

Sounds good! I think a call early next year would probably be very helpful