RMark time.intervals error

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

RMark time.intervals error

Postby K.Haigh » Mon Jun 19, 2023 10:25 pm

Hi,

I am trying to run a robust design model using RMark. I have 32-years of mark-recapture data: primary periods = 128 (Austral seasons), and secondary periods = number of survey days per season.
I have specified primary and secondary periods in the time.intervals argument, however, when attempting to run process.data I get the following error:

Error in process.data(data = PRD, model = "Robust", time.intervals = time.intervals) :
Incorrect number of time intervals. One or more capture history lengths do not match time interval structure.

I have checked my capture histories and they are all the same length, what could be the cause of this error?

Thanks!
K.Haigh
 
Posts: 5
Joined: Thu Jun 15, 2023 12:44 am

Re: RMark time.intervals error

Postby jlaake » Mon Jun 19, 2023 10:40 pm

This should have been posted in the RMark forum given its title. But can't help unless we know the length of the capture histories and the value of time.intervals. Even if the capture histories are the same length you may have not specified the time.intervals correctly. Have you looked at the robust example to make sure you understand how it should be structured? Possibly a missing comma in vector of time.intervals. Lots of reasons for the mismatch.
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: RMark time.intervals error

Postby K.Haigh » Tue Jun 20, 2023 12:08 am

Thanks for your response - apologies for posting in the wrong forum!

Length of capture histories are 1,651 encounters

My secondary periods (no. survey days p/ season) are:

Code: Select all
13,26,19,23,12,26,13,21,16,22,21,14,14,21,13,11,11,21,8,12,6,13,14,10,9,11,6,12,17,16,13,12,13,15,13,14,11,13,19,20,18,28,20,20,22,24,11,18,24,22,14,21,14,21,14,17,27,24,17,19,22,16,13,20,10,15,10,14,9,13,8,19,17,9,12,14,9,13,8,19,17,9,12,14,9,10,6,12,9,6,9,11,5,11,11,11,14,9,14,6,7,15,11,13,11,6,11,14,12,13,8,16,7,7,4,2,2,8,6,5,5,2,8,3,2,3,7,8,4,10,14,13,6,8,11,6


This is how I specified time.intervals below after looking at the robust example:
Code: Select all
time.intervals=c(0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0)
K.Haigh
 
Posts: 5
Joined: Thu Jun 15, 2023 12:44 am

Re: RMark time.intervals error

Postby jlaake » Tue Jun 20, 2023 12:27 am

I think forum may be choking on your message as I can't see all of it here but in the email message, I saw a 10, which presumably should be 1,0,

I suggest you go through the values you have entered carefully. You can use length(time.intervals) to check its length and see if any are not 0 or 1.
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: RMark time.intervals error

Postby K.Haigh » Tue Jun 20, 2023 12:57 am

Thanks for spotting that, I just found it and changed it!

length(time.intervals) is showing 1,651 although I still receive the same error "Incorrect number of time intervals. One or more capture history lengths do not match time interval structure" :?
K.Haigh
 
Posts: 5
Joined: Thu Jun 15, 2023 12:44 am

Re: RMark time.intervals error

Postby egc » Tue Jun 20, 2023 7:41 am

jlaake wrote:I think forum may be choking on your message as I can't see all of it here...


Nope -- its because the code wasn't embedded in the 'code' tag.
egc
Site Admin
 
Posts: 201
Joined: Thu May 15, 2003 3:25 pm

Re: RMark time.intervals error

Postby jlaake » Tue Jun 20, 2023 7:42 pm

If the length of the capture histories is 1651 the length of the intervals should be 1 less at 1650 because it is the intervals between occasions. If you look through the robust example you will see that the length of the capture history is 15 and the length of the time.intervals is 14.

Here is the code that is giving the error in process.data. Probably not the best error message because it isn't strictly an incorrect number of time intervals but the number or structure of the time.intervals.From the time.intervals the code works out the number of secondary occasions and the sum of the secondary occasions should match the length of the capture history.
Code: Select all
      if (any(nchar(data$ch)/model.list$divisor != sum(nocc.secondary)))
        stop("Incorrect number of time intervals. One or more capture history lengths do not match time interval structure.")


In your email showing the intervals I also saw several exclamation points but since you didn't wrap in code argument in posting I'm not sure if they are there or not. Please check your intervals more closely. Better yet modify the following code to set secondary periods that you are using and this will generate your time.intervals for you. This is setup using secondary occasions for robust example. Just change to specify your vector of secondary occasions. Anytime you have something this large you should be using code to avoid errors.

Code: Select all
secondary=c(2,2,4,5,2)
time.intervals=c()
for(int in 1:length(secondary))
{
  if(int==length(secondary))
    time.intervals=c(time.intervals,c(rep(0,secondary[int]-1)))
  else
    time.intervals=c(time.intervals,c(rep(0,secondary[int]-1),1))
}
time.intervals
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: RMark time.intervals error

Postby K.Haigh » Tue Jun 20, 2023 10:42 pm

Thanks for your response and sorry about not embedding my message in the 'code' tag before - this is all new to me!

I removed one of the zeros in my time.intervals to make it 1650 and now my primary and secondary periods are being correctly identified - thanks for your help! :)
K.Haigh
 
Posts: 5
Joined: Thu Jun 15, 2023 12:44 am


Return to RMark

Who is online

Users browsing this forum: No registered users and 1 guest