kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

understanding X.array #26

Closed klg-2016 closed 4 years ago

klg-2016 commented 4 years ago

does this sound right for understanding the array in English: for every camera (one layer with dimensions of presence/absence combos and covariates), for every presence/absence combo, if there is a 1 in the cell (as you said in your notes), fill in the covariates?

is there a part of the code telling it to go iteratively along the covariates?

kaitlyngaynor commented 4 years ago

It's in that for loop - have a look at the new "detective work" that I did. As I note, I still don't FULLY understand what is going on with the true/false statements but I think I understand how the input needs to be formatted based on the number of species, covariates of interest, order of variables in the design matrix, etc

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/4c8797ba1c684f73000f0fdbaade0314b4d39c72/Rota%20Data/Formatting%20Data%20annotated.Rmd#L133-L154

kaitlyngaynor commented 4 years ago

I am trying to find a way to view just a "slice" of the X.array matrix so we can peek under the hood a bit more...

klg-2016 commented 4 years ago

thank you, that makes more sense

you have a note that the second dimension is the covariate, but I thought we'd said above that the second dimension corresponded to the presence/absence combos?

kaitlyngaynor commented 4 years ago

So... the value in a given cell is equal to the covariate value at that camera site, IF it is a covariate that we are interested in for that species combo (1234). The x dimension represents the camera, the y dimension represents the number of unique species combos, and the z dimension represents the covariate. Sorry for the confusion.

I did figure out a way to slice the matrix! Think of it as a cube that you can take a slice of in 3 different ways...

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/c81c5daad7d0ce955bdf63cd7629d6fc3e45f91f/Rota%20Data/Formatting%20Data%20annotated.Rmd#L155-L158

klg-2016 commented 4 years ago

I am sitting here with my laptop and a sheet of paper to help with visualizing the cube, trying to think it through.

kaitlyngaynor commented 4 years ago

Haha yeah it's a bit of a puzzle to wrap one's head around... at least it's 3 dimensions and not 4, hahah

klg-2016 commented 4 years ago

That's a very good point! I'm glad it's only 3 dimensions as well. It's definitely making more and more sense, thank you for your explanations! :)

I'm going to disappear for a bit to walk the dogs and come back after

kaitlyngaynor commented 4 years ago

Cool cool. I think I'm actually at a point where I pretty much understand the input. now moving on to the stan code... oof, I don't know stan