MurrayEfford / openCR

Open Population Capture-Recapture
3 stars 0 forks source link

Issue with openCR.fit for Multi-Session Model #12

Open AlexWainer opened 1 month ago

AlexWainer commented 1 month ago

Hi Murray!

I am encountering an issue when trying to create a multi-session model using the openCR.fit function. The code runs without errors when using secr.fit, but it fails with openCR.fit, even though openCR is built on secr.

# Create traps objects, specifying the coordinate columns
traps_2013 <- read.traps(data = tdf_2013, detector = "proximity", trapID = "trapID")
traps_2014 <- read.traps(data = tdf_2014, detector = "proximity", trapID = "trapID")

# Create capture history objects
capt_hist_2013 <- make.capthist(edf_2013, traps_2013, fmt = "trapID")
capt_hist_2014 <- make.capthist(edf_2014, traps_2014, fmt = "trapID")

capt_hist <- MS.capthist(capt_hist_2013, capt_hist_2014)

# Fit the open model
fit_openCR <- openCR.fit(capthist = capt_hist,
                         model = list(p~1, phi~1, sigma~1),
                         detectfn = 'HHN', 
                         mask = msk, 
                         type = 'CJSsecr')

Expected Behavior

I expect the openCR.fit function to successfully fit a multi-session model, similar to how secr.fit functions.

Actual Behavior

The function throws the following error: Error in 1:J : NA/NaN argument

Any help will be appreacited. Thanks a lot!

MurrayEfford commented 1 month ago

Hello Alex I don't think I know you, do I? I think you will find this works if you specify the interval between sessions (e.g. , intervals=1 in 'openCR.fit', or in a preceding 'join' step). The secr package has no use for the intervals attribute. If you have a serious application I suggest you check Efford & Schofield on the (in)validity of CJSsecr as a model (see also the details argument CJSp1). Requests for help on software use are better directed to one of the online lists. Murray

AlexWainer commented 1 month ago

Hi Murray,

Thank you so much for the help and sorry I did not post it in the right place.

We have never met before but we are using your research on open SCR models for my honours thesis at UCT. The thesis is titled "Estimating leopard population dynamics using an open SCR model".

Kind regards, Alex

On Sat, Jul 13, 2024 at 9:39 AM MurrayEfford @.***> wrote:

Hello Alex I don't think I know you, do I? I think you will find this works if you specify the interval between sessions (e.g. , intervals=1 in 'openCR.fit', or in a preceding 'join' step). The secr package has no use for the intervals attribute. If you have a serious application I suggest you check Efford & Schofield on the (in)validity of CJSsecr as a model (see also the details argument CJSp1). Requests for help on software use are better directed to one of the online lists. Murray

— Reply to this email directly, view it on GitHub https://github.com/MurrayEfford/openCR/issues/12#issuecomment-2226809664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZBTF64HCB6IJ6ZCSENVKU3ZMDKTXAVCNFSM6AAAAABKZBK3Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWHAYDSNRWGQ . You are receiving this because you authored the thread.Message ID: @.***>