kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

how does colext know which records belong to which season? #115

Closed klg-2016 closed 3 years ago

klg-2016 commented 3 years ago

This might be something I figure out just with working through the code, but I think the function colext only asks for the number of primary seasons (so in our case, # years = 4) and I'm not sure it has another way of knowing which records correspond to which days/years. I'm concerned that with a different number of days from 2019 because of when the cameras were last checked, it will take our total number of days, divide by 4, and split seasons incorrectly. Not sure if that's the case, but I wanted to note it while I'm thinking about it

kaitlyngaynor commented 3 years ago

Hmm. This seems unlikely? But if not, that's an issue... let me know if you need more help thinking through this. I haven't rolled up my sleeves with the code this time, but can do so in the future if you're hitting a wall

klg-2016 commented 3 years ago

Will do--I'll pay attention as I keep working with the code and see if I can figure out what it's doing.

klg-2016 commented 3 years ago

OK, so I have a full UMF with all of the covariates I'm planning to start with and this is from its summary: 60 sites Maximum number of observations per site: 440 Mean number of observations per site: 320.18 Number of primary survey periods: 4 Number of secondary survey periods: 110 Sites with at least one detection: 59

The "Number of secondary survey periods" at 110 seems to suggest that it does what I was concerned it would do, which is just split total days by the number of primary periods. A solution for this could be adding in the "sessionCol" to the cameraOperation function, which would explicitly define which records belong to which season. Another solution might be waiting for the rest of the 2019 data so it has the same number of days, but I imagine that will be a while (if you said it was just coming back to the US this month, right?)

I'm also going to check out the google group again and see if I can find any discussion of this.

kaitlyngaynor commented 3 years ago

Hmm that's too bad... I guess you should go with sessionCol approach?

Yes, 2019 data will likely be a while—I just checked in about the status of the hard drive. March was the tentative timeline for making it back, but there will be several more months before data would be uploaded + classified + cleaned.

On Thu, Mar 18, 2021 at 10:34 AM klg-2016 @.***> wrote:

OK, so I have a full UMF with all of the covariates I'm planning to start with and this is from its summary: 60 sites Maximum number of observations per site: 440 Mean number of observations per site: 320.18 Number of primary survey periods: 4 Number of secondary survey periods: 110 Sites with at least one detection: 59

The "Number of secondary survey periods" at 110 seems to suggest that it does what I was concerned it would do, which is just split total days by the number of primary periods. A solution for this could be adding in the "sessionCol" to the cameraOperation function, which would explicitly define which records belong to which season. Another solution might be waiting for the rest of the 2019 data so it has the same number of days, but I imagine that will be a while (if you said it was just coming back to the US this month, right?)

I'm also going to check out the google group again and see if I can find any discussion of this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802149943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT4GIAKTXEJDSCBDUK3TEI2RJANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

do you have the camera operation data in the previous format? (i.e., the format without a single row for every camera). I have a file called "Camera_operation_year1-4", do you know if that's a good one to be working from? I know you did a fair amount of cleaning to get to the consolidated version; I'm not sure which base you were working from.

That's what I was thinking, thank you.

kaitlyngaynor commented 3 years ago

I used these three raw files (year 1-2, year 3, year 4—which don't really correspond to "year" per se, it's a bit of a misnomer) in this folder here https://github.com/wildcam-gorongosa/data-cleaning/tree/master/operation-files .

Meredith also used these to create Camera_operation_year1-4. We both wrote separate scripts to get them into the two different consolidated versions (see Meredith's https://github.com/wildcam-gorongosa/data-cleaning/blob/master/MSP_consolidate_wildcam.R and mine https://github.com/wildcam-gorongosa/data-cleaning/blob/master/convert-operation-to-camtrapr-format.R). Do you suspect a problem with my script? Let me know!

On Thu, Mar 18, 2021 at 10:43 AM klg-2016 @.***> wrote:

do you have the camera operation data in the previous format? (i.e., the format without a single row for every camera). I have a file called "Camera_operation_year1-4", do you know if that's a good one to be working from? I know you did a fair amount of cleaning to get to the consolidated version; I'm not sure which base you were working from.

That's what I was thinking, thank you.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802156459, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WTY5U5GIEUGJSJGFLL3TEI3VVANCNFSM4YT3WBLA .

kaitlyngaynor commented 3 years ago

To clarify, the three input files are all in that same format (a single row for every camera), just for different time periods

klg-2016 commented 3 years ago

Thank you! I'll take a look.

No, I haven't looked at your script at all yet--I knew you'd been working with one but I wasn't sure where. So no suspected problems, just trying to figure out how to get the format I need without recreating any wheels.

kaitlyngaynor commented 3 years ago

Ok sounds good. That repo was private but I just made it public so you can have a look. Nothing too sensitive on there so I don't see harm in leaving it public but I know Meredith is a bit sensitive about data sharing considerations (though it's just camera operation data up there)

klg-2016 commented 3 years ago

Sounds good, thank you! I also just asked in the Google group to see if I'm missing any solutions and then I'll move forward with my plan.

klg-2016 commented 3 years ago

got a response from the unmarked google group telling me to post in the camtrapR google group, so I've done that. the suggestion came with an alternative option of manually building my y-matrix from the raw data, which I asked for further info on because I'm not sure exactly what he means/how to do that.

I also took Meredith's code to work on getting stuff into the format I need. Right now I have this (I added a session column to each spreadsheet before joining them):

Camera_operation_year1-4_sessions.xlsx

As far as I understand for implementing the "sessionCol", this is almost in the format I need it to be. However, there are two aspects I need to address and I'm not sure how to approach them:

I think I would know how to do this manually, but I'm kind of at a loss for where to start if I want to use R. If I've been clear enough in explaining where I'm confused, do you have any advice on where to begin thinking about it?

Thanks!

kaitlyngaynor commented 3 years ago

Hmm I would just work from the consolidated spreadsheet that I made rather than the raw files because, as you note, there is some fuzziness between the "years." We didn't really intend for the individual sheets to be used in analysis.

What does the output from camtrapR look like? (So, in other words, what is X in the process Camera_operation_year1-4 --> X --> colext/unmarked?) Can you just generate one master matrix for the entire study period using the consolidated sheet, and then try to get to X some other way by subsetting columns of the matrix to correspond to the date window for each season, and then wrangling from there? (sorry if that question is confusing)

On Thu, Mar 18, 2021 at 8:27 PM klg-2016 @.***> wrote:

got a response from the unmarked google group telling me to post in the camtrapR google group, so I've done that. the suggestion came with an alternative option of manually building my y-matrix from the raw data, which I asked for further info on because I'm not sure exactly what he means/how to do that.

I also took Meredith's code to work on getting stuff into the format I need. Right now I have this (I added a session column to each spreadsheet before joining them):

Camera_operation_year1-4_sessions.xlsx https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/files/6168420/Camera_operation_year1-4_sessions.xlsx

As far as I understand for implementing the "sessionCol", this is almost in the format I need it to be. However, there are two aspects I need to address and I'm not sure how to approach them:

  • First, right now every row associated with the year1and2 data has "1" as a session column. I think what I need is to duplicate rows for the cameras that are relevant for both seasons, and assign session "2" to the appropriate rows. This will also include carrying over only the relevant problems to the second season.
  • Second, some of these cameras "ended" for year1and2 and "started" for year3 during the middle of the late dry season in 2018 (so session 3). I need to correct the start date for the third session so it's included in here as covering the full span of the season.

I think I would know how to do this manually, but I'm kind of at a loss for where to start if I want to use R. If I've been clear enough in explaining where I'm confused, do you have any advice on where to begin thinking about it?

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802519912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT6ZTVXKVSB6ADPBHDTTELACJANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

kaitlyngaynor commented 3 years ago

Re: master matrix, I was thinking something created by the cameraOperation function: https://rdrr.io/cran/camtrapR/man/cameraOperation.html

Gotcha re: X, but what are you going to do with X once you have it? I imagine that you can't then put that into unmarked as is? What function are you putting this spreadsheet into? I was assuming that you were using that cameraOperation function with a sessionCol = argument to generate a multiseason operability matrix, and was thinking that we could just do our own magic to try to get a matrix WITHOUT sessionCol into whatever "X" would be spit out if we DID use sessionCol, but I'm not sure what that X looks like.

But maybe that isn't what you are doing? Does my question make more sense now? (again, please ignore my suggestions if I'm not properly caught up, my apologies!)

On Thu, Mar 18, 2021 at 8:51 PM klg-2016 @.***> wrote:

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802530669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WTZQFUHUYKVDZVDLS7LTELC5HANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

Nope, your questions make perfect sense. I was thinking about using the sessioncol argument in the cameraOperation function, and I don't actually know what that spits out/what that X would be. So now I have a better idea of what you're asking for/getting at, but not an answer.

The camera operation function is also really only a stepping stone to get to the detection history (that's what goes into the UMF function at the end). Right now my multi season detection history (created from the consolidated data) just has a row for each camera and a column for each day we're including, with all cells filled with 0, 1 or NA. I'm guessing that using the session column argument somehow informs the resulting detection history to include which days belong to which seasons, but I don't know how (or if it actually does).

I feel like the simplest way to include session info in a detection history would be through a row with which session it was (so for us, 122 "1"s across, then 122 "2"s, etc), but I'm pretty sure the function would read that as another camera and that can't be what's happening.

On Thu, Mar 18, 2021, 11:57 PM Kaitlyn Gaynor @.***> wrote:

Re: master matrix, I was thinking something created by the cameraOperation function: https://rdrr.io/cran/camtrapR/man/cameraOperation.html

Gotcha re: X, but what are you going to do with X once you have it? I imagine that you can't then put that into unmarked as is? What function are you putting this spreadsheet into? I was assuming that you were using that cameraOperation function with a sessionCol = argument to generate a multiseason operability matrix, and was thinking that we could just do our own magic to try to get a matrix WITHOUT sessionCol into whatever "X" would be spit out if we DID use sessionCol, but I'm not sure what that X looks like.

But maybe that isn't what you are doing? Does my question make more sense now? (again, please ignore my suggestions if I'm not properly caught up, my apologies!)

On Thu, Mar 18, 2021 at 8:51 PM klg-2016 @.***> wrote:

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802530669 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHA7WTZQFUHUYKVDZVDLS7LTELC5HANCNFSM4YT3WBLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802533112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6KICXBV2QRGV267IUFFRLTELDTJANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

For a study with M sites, T years, and a maximum of J observations per site-year, the data can be supplied in a variety of ways but are stored as follows. y is an (M \times TJ) matrix, with each row corresponding to a site.

Can I just pad the last columns with NAs to fill out the 122 days of the final season? Do you think that would work?

On Fri, Mar 19, 2021, 12:11 AM Katie Grabowski @.***> wrote:

Nope, your questions make perfect sense. I was thinking about using the sessioncol argument in the cameraOperation function, and I don't actually know what that spits out/what that X would be. So now I have a better idea of what you're asking for/getting at, but not an answer.

The camera operation function is also really only a stepping stone to get to the detection history (that's what goes into the UMF function at the end). Right now my multi season detection history (created from the consolidated data) just has a row for each camera and a column for each day we're including, with all cells filled with 0, 1 or NA. I'm guessing that using the session column argument somehow informs the resulting detection history to include which days belong to which seasons, but I don't know how (or if it actually does).

I feel like the simplest way to include session info in a detection history would be through a row with which session it was (so for us, 122 "1"s across, then 122 "2"s, etc), but I'm pretty sure the function would read that as another camera and that can't be what's happening.

On Thu, Mar 18, 2021, 11:57 PM Kaitlyn Gaynor @.***> wrote:

Re: master matrix, I was thinking something created by the cameraOperation function: https://rdrr.io/cran/camtrapR/man/cameraOperation.html

Gotcha re: X, but what are you going to do with X once you have it? I imagine that you can't then put that into unmarked as is? What function are you putting this spreadsheet into? I was assuming that you were using that cameraOperation function with a sessionCol = argument to generate a multiseason operability matrix, and was thinking that we could just do our own magic to try to get a matrix WITHOUT sessionCol into whatever "X" would be spit out if we DID use sessionCol, but I'm not sure what that X looks like.

But maybe that isn't what you are doing? Does my question make more sense now? (again, please ignore my suggestions if I'm not properly caught up, my apologies!)

On Thu, Mar 18, 2021 at 8:51 PM klg-2016 @.***> wrote:

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802530669 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHA7WTZQFUHUYKVDZVDLS7LTELC5HANCNFSM4YT3WBLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802533112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6KICXBV2QRGV267IUFFRLTELDTJANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

From: https://www.rdocumentation.org/packages/unmarked/versions/1.0.1/topics/unmarkedMultFrame

On Fri, Mar 19, 2021, 12:17 AM Katie Grabowski @.***> wrote:

For a study with M sites, T years, and a maximum of J observations per site-year, the data can be supplied in a variety of ways but are stored as follows. y is an (M \times TJ) matrix, with each row corresponding to a site.

Can I just pad the last columns with NAs to fill out the 122 days of the final season? Do you think that would work?

On Fri, Mar 19, 2021, 12:11 AM Katie Grabowski < @.***> wrote:

Nope, your questions make perfect sense. I was thinking about using the sessioncol argument in the cameraOperation function, and I don't actually know what that spits out/what that X would be. So now I have a better idea of what you're asking for/getting at, but not an answer.

The camera operation function is also really only a stepping stone to get to the detection history (that's what goes into the UMF function at the end). Right now my multi season detection history (created from the consolidated data) just has a row for each camera and a column for each day we're including, with all cells filled with 0, 1 or NA. I'm guessing that using the session column argument somehow informs the resulting detection history to include which days belong to which seasons, but I don't know how (or if it actually does).

I feel like the simplest way to include session info in a detection history would be through a row with which session it was (so for us, 122 "1"s across, then 122 "2"s, etc), but I'm pretty sure the function would read that as another camera and that can't be what's happening.

On Thu, Mar 18, 2021, 11:57 PM Kaitlyn Gaynor @.***> wrote:

Re: master matrix, I was thinking something created by the cameraOperation function: https://rdrr.io/cran/camtrapR/man/cameraOperation.html

Gotcha re: X, but what are you going to do with X once you have it? I imagine that you can't then put that into unmarked as is? What function are you putting this spreadsheet into? I was assuming that you were using that cameraOperation function with a sessionCol = argument to generate a multiseason operability matrix, and was thinking that we could just do our own magic to try to get a matrix WITHOUT sessionCol into whatever "X" would be spit out if we DID use sessionCol, but I'm not sure what that X looks like.

But maybe that isn't what you are doing? Does my question make more sense now? (again, please ignore my suggestions if I'm not properly caught up, my apologies!)

On Thu, Mar 18, 2021 at 8:51 PM klg-2016 @.***> wrote:

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802530669 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHA7WTZQFUHUYKVDZVDLS7LTELC5HANCNFSM4YT3WBLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802533112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6KICXBV2QRGV267IUFFRLTELDTJANCNFSM4YT3WBLA .

kaitlyngaynor commented 3 years ago

Ah ok I get it now—yes I think you should try padding with NAs!! Also I don't mean to keep you up, we can pick this up another time :)

On Thu, Mar 18, 2021 at 9:18 PM klg-2016 @.***> wrote:

From:

https://www.rdocumentation.org/packages/unmarked/versions/1.0.1/topics/unmarkedMultFrame

On Fri, Mar 19, 2021, 12:17 AM Katie Grabowski @.***> wrote:

For a study with M sites, T years, and a maximum of J observations per site-year, the data can be supplied in a variety of ways but are stored as follows. y is an (M \times TJ) matrix, with each row corresponding to a site.

Can I just pad the last columns with NAs to fill out the 122 days of the final season? Do you think that would work?

On Fri, Mar 19, 2021, 12:11 AM Katie Grabowski < @.***> wrote:

Nope, your questions make perfect sense. I was thinking about using the sessioncol argument in the cameraOperation function, and I don't actually know what that spits out/what that X would be. So now I have a better idea of what you're asking for/getting at, but not an answer.

The camera operation function is also really only a stepping stone to get to the detection history (that's what goes into the UMF function at the end). Right now my multi season detection history (created from the consolidated data) just has a row for each camera and a column for each day we're including, with all cells filled with 0, 1 or NA. I'm guessing that using the session column argument somehow informs the resulting detection history to include which days belong to which seasons, but I don't know how (or if it actually does).

I feel like the simplest way to include session info in a detection history would be through a row with which session it was (so for us, 122 "1"s across, then 122 "2"s, etc), but I'm pretty sure the function would read that as another camera and that can't be what's happening.

On Thu, Mar 18, 2021, 11:57 PM Kaitlyn Gaynor @.***> wrote:

Re: master matrix, I was thinking something created by the cameraOperation function: https://rdrr.io/cran/camtrapR/man/cameraOperation.html

Gotcha re: X, but what are you going to do with X once you have it? I imagine that you can't then put that into unmarked as is? What function are you putting this spreadsheet into? I was assuming that you were using that cameraOperation function with a sessionCol = argument to generate a multiseason operability matrix, and was thinking that we could just do our own magic to try to get a matrix WITHOUT sessionCol into whatever "X" would be spit out if we DID use sessionCol, but I'm not sure what that X looks like.

But maybe that isn't what you are doing? Does my question make more sense now? (again, please ignore my suggestions if I'm not properly caught up, my apologies!)

On Thu, Mar 18, 2021 at 8:51 PM klg-2016 @.***> wrote:

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802530669

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AHA7WTZQFUHUYKVDZVDLS7LTELC5HANCNFSM4YT3WBLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802533112 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AP6KICXBV2QRGV267IUFFRLTELDTJANCNFSM4YT3WBLA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802541340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT5TTLOXECL5R3Z5EATTELGARANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

Sounds good! I'll try that. I feel like this is a potentially very simple solution that only occurred to me after running through several far more complicated options 😂

You're not keeping me up, I was puzzling over this anyway haha.

On Fri, Mar 19, 2021, 12:20 AM Kaitlyn Gaynor @.***> wrote:

Ah ok I get it now—yes I think you should try padding with NAs!! Also I don't mean to keep you up, we can pick this up another time :)

On Thu, Mar 18, 2021 at 9:18 PM klg-2016 @.***> wrote:

From:

https://www.rdocumentation.org/packages/unmarked/versions/1.0.1/topics/unmarkedMultFrame

On Fri, Mar 19, 2021, 12:17 AM Katie Grabowski @.***> wrote:

For a study with M sites, T years, and a maximum of J observations per site-year, the data can be supplied in a variety of ways but are stored as follows. y is an (M \times TJ) matrix, with each row corresponding to a site.

Can I just pad the last columns with NAs to fill out the 122 days of the final season? Do you think that would work?

On Fri, Mar 19, 2021, 12:11 AM Katie Grabowski < @.***> wrote:

Nope, your questions make perfect sense. I was thinking about using the sessioncol argument in the cameraOperation function, and I don't actually know what that spits out/what that X would be. So now I have a better idea of what you're asking for/getting at, but not an answer.

The camera operation function is also really only a stepping stone to get to the detection history (that's what goes into the UMF function at the end). Right now my multi season detection history (created from the consolidated data) just has a row for each camera and a column for each day we're including, with all cells filled with 0, 1 or NA. I'm guessing that using the session column argument somehow informs the resulting detection history to include which days belong to which seasons, but I don't know how (or if it actually does).

I feel like the simplest way to include session info in a detection history would be through a row with which session it was (so for us, 122 "1"s across, then 122 "2"s, etc), but I'm pretty sure the function would read that as another camera and that can't be what's happening.

On Thu, Mar 18, 2021, 11:57 PM Kaitlyn Gaynor @.***> wrote:

Re: master matrix, I was thinking something created by the cameraOperation function: https://rdrr.io/cran/camtrapR/man/cameraOperation.html

Gotcha re: X, but what are you going to do with X once you have it? I imagine that you can't then put that into unmarked as is? What function are you putting this spreadsheet into? I was assuming that you were using that cameraOperation function with a sessionCol = argument to generate a multiseason operability matrix, and was thinking that we could just do our own magic to try to get a matrix WITHOUT sessionCol into whatever "X" would be spit out if we DID use sessionCol, but I'm not sure what that X looks like.

But maybe that isn't what you are doing? Does my question make more sense now? (again, please ignore my suggestions if I'm not properly caught up, my apologies!)

On Thu, Mar 18, 2021 at 8:51 PM klg-2016 @.***> wrote:

Mmmm I hadn't thought about working from the consolidated spreadsheet--I was thinking that the other 1-4 option would be easier because they're already separate, but you're probably right, the fuzziness likely erases that benefit.

OK, the output I'm working toward (my X, which may or may not work when I try it but it's my current goal) has: 1 row/camera/active season (I don't think you would have empty rows for inactive seasons, but I'll address that when I get there if it doesn't work without them) So the start and end dates that correspond to that year's operating dates, plus any problems, and then a column for "session" as well.

Do you have something in your head for your "master matrix" as a step between the consolidated sheet and X? I'm imagining if statements that would let me determine which year it was and correctly fill in the "session" column, but I don't know how I would get the correct info into more than one row for a camera to start. I'm also about to go to bed, so I'll come back at this probably tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802530669

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AHA7WTZQFUHUYKVDZVDLS7LTELC5HANCNFSM4YT3WBLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802533112

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AP6KICXBV2QRGV267IUFFRLTELDTJANCNFSM4YT3WBLA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802541340 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHA7WT5TTLOXECL5R3Z5EATTELGARANCNFSM4YT3WBLA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802542311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6KICVK2XAKS7MOXZZWXKTTELGJFANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

OK, this probably isn't the most elegant way to pad, but I did this (within the detectionhistory function: DetHist_complete <- merge(DetHist_16_17_18, DetHist_19, by = 0, all = TRUE) #merges 16/17/18 with 19; throws a warning padding <- data.frame(matrix(NA, nrow = 60, ncol = 48)) #creating a matrix to pad the "missing" data from 2019 padding$Row.names <- DetHist_complete$Row.names #need a shared column to merge the two data frames DetHist_complete <- merge(DetHist_complete, padding, by = "Row.names") DetHist_complete$Row.names <- NULL #merging the two data frames created a Row.names column, which I don't need in the final detection history

and now the UMF summary shows this: 60 sites Maximum number of observations per site: 488 Mean number of observations per site: 320.18 Number of primary survey periods: 4 Number of secondary survey periods: 122 Sites with at least one detection: 59

So I think I have this as set as I can have it at the moment, and this is where I'm going to pause for now.

klg-2016 commented 3 years ago

sorry I don't know why it got rid of spaces between lines in the code--I have it separated out in R

kaitlyngaynor commented 3 years ago

great, glad you found a workaround!

On Fri, Mar 19, 2021 at 8:42 AM klg-2016 @.***> wrote:

sorry I don't know why it got rid of spaces between lines in the code--I have it separated out in R

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-802924837, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT3TIJDVJQ2GHSXCCSTTENWEPANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

So I got a response to my question about having 110 secondary survey periods when I posted to camtrapR:

Hi Katie, the main problem with treating multiple seasons as one season (one row per camera and using the problem columns) is the closure assumption, which will most likely not hold over extended time frames. So yes, I believe using the session column would be the best way forward. In your case it would mean separating the multiple deployments into separate rows and creating a session column to keep them apart.

He then includes suggestions for how to figure out using the session column.

BUT. If the issue is a potential closure issue, then it doesn't matter how I get to my detection history, right? The issue is still a potential issue either way. So I should be alright to stick with my workaround?

kaitlyngaynor commented 3 years ago

I think the workaround should be fine? But I say that with a very limited understanding of unmarked :)

On Sat, Mar 20, 2021 at 11:49 AM klg-2016 @.***> wrote:

So I got a response to my question about having 110 secondary survey periods when I posted to camtrapR: Hi Katie, the main problem with treating multiple seasons as one season (one row per camera and using the problem columns) is the closure assumption, which will most likely not hold over extended time frames. So yes, I believe using the session column would be the best way forward. In your case it would mean separating the multiple deployments into separate rows and creating a session column to keep them apart.

He then includes suggestions for how to figure out using the session column.

BUT. If the issue is a potential closure issue, then it doesn't matter how I get to my detection history, right? The issue is still a potential issue either way. So I should be alright to stick with my workaround?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/issues/115#issuecomment-803444516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7WT6APPBXHRDYR5DJFUDTETU3TANCNFSM4YT3WBLA .

klg-2016 commented 3 years ago

Sounds good, thank you!