Page 1 of 1

missing encounter history data

PostPosted: Thu Feb 17, 2011 5:38 pm
by binabk
I am having problem in coding missing capture occasion. For the occssions when there was no capture session for a particular site, I am coding it with dot(.). For some reason R is not taking this value. It gives the message" Capture history length is not constant. ch must be a character string" and list out the row numbers with incorrect ch length. I double checked the capture history length. If you count the dots(.), the length is fine for those error rows.

How can I resolve this issue?

Thank you.

Re: missing encounter history data

PostPosted: Tue Feb 22, 2011 2:09 pm
by harding
You might check to make sure your .'s have not been autoformated as an elipsis. Might happen if you had "..." or "...." in a history.

But more importantly, I think you have misunderstood the use of the . to code for missing data. As I understand it, the . would be relevant for something like a multistate history if you knew an animal to be alive but did not know which state it was in. Probably the easiest means to deal with missing capture occasions would be to put a 0 in the history for the missed events and then set the capture probability to 0 for those occassions.

Re: missing encounter history data

PostPosted: Tue Feb 22, 2011 6:06 pm
by dhewitt
You never say, and given that this was posted in the RMark subforum we can only guess, but the '.' is only allowed in the encounter histories for certain data types (models). This includes occupancy and density models based on radio transmitter relocation data. What models are you working with?

The other response from harding adds some confusion because we don't know for sure what model is involved. If this is occupancy modeling (my guess on what you are doing) and you missed a survey (weather, e.g.), your use is correct. The suggestion for use of the '.' in the multistate context is incorrect I think. I am not well-versed in the MS stuff but I think it would be better to have a model that addresses state uncertainty directly.

Re: missing encounter history data

PostPosted: Tue Feb 22, 2011 6:31 pm
by jlaake
The posting by harding about the ellipsis is possible but dhewitt is correct that the "." is not for the MS models as they are currently coded. No reason though that "." couldn't be used to represent an uncertain state if the code knew to interpret that way. We do need to know what model you are using. They aren't all interchangeable. One quick way to find the problems is to use nchar to get the lengths of each of the capture histories.

Here is an example with dipper.

> data(dipper)
> nchar(dipper$ch)
[1] 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

Now I'll mess up the second and 44th ch and show how to identify which have a length that doesn't match length of first capture history which is presumed to be correct here.

> dipper$ch[2]="000100"
> dipper$ch[44]="100100"
> dipper[nchar(dipper$ch)!=nchar(dipper$ch[1]),]
ch sex
2 000100 Female
44 100100 Female

If you know the length (say 7 in this case), you could use:
> dipper[nchar(dipper$ch)!=7,]
ch sex
2 000100 Female
44 100100 Female

I hope this helps you track down the problem. The solution harding provided would be fine for something like CJS or occupancy and the dot notation is simply a short-hand way of doing so. The solution of using 0 is not a particularly good one for MS state uncertainty. See paper by Conn and Cooch in Journal of Applied Ecology 2009.