Error in if (x4 > x2) { : argument is of length zero

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

Error in if (x4 > x2) { : argument is of length zero

Postby Snook » Wed Apr 13, 2011 12:38 pm

I have searched through previous responses to issues with this error and have yet to figure a solution for my instance of this error message.

I am running simulated data into the Barker model (1000 individuals, 6 monthly capture occasions, returning a single S value, and fixing r and p to 0 as I am relying on resightings and not physical captures). The model works a lot of the time, except when I simulate data using high survival and capture probabilities (.8=CapProb and .9=survival monthly for this instance). Then, sometimes, I get this error and sometimes the model runs fine.

Looking at the output file I get:

"ERROR -- Numerical convergence never reached, with maximum G = 83.08346
Final Parameter Values:
0.914964 0.809122 0.438126 0.475021 0.475021
0.00000 "

This is obviously an issue in itself, but it is also problematic when I am running 1,000 data simulations, and one bad apple crashes the entire loop. Any thoughts on how to address the issue? Or even how to stop this failure of convergence from crashing the entire simulation?


I have pasted the input file from my latest crash below:


"proc title ;
proc chmatrix occasions= 6 groups= 1 etype= Barker ICMeans NoHist hist= 1000 ;
time interval 1 1 1 1 1 1 ;
glabel(1)=Group 1;
100202020202 1;
100202000000 1;
120200000202 1;
120200020200 1;
120200020200 1;
120202020002 1;
100202000000 1;
120002020202 1;
120202020202 1;
100202020202 1;
120000000000 1;
120202000202 1;
120202000002 1;
100202000000 1;
100000000000 1;
100002020202 1;
100000000000 1;
100202020000 1;
120002020202 1;
120202020200 1;
120000020202 1;
100000000000 1;
120202020202 1;
100000000000 1;
100200000000 1;
100200000000 1;
120202020200 1;
120202020202 1;
120200020200 1;
120000000000 1;
120002020200 1;
120000000000 1;
100200000000 1;
120000000000 1;
120000000000 1;
120202000002 1;
100002020202 1;
120202020002 1;
100200020202 1;
120202000000 1;
120002000000 1;
120202000000 1;
100000000000 1;
120202020002 1;
120202020000 1;
120202020202 1;
120202000000 1;
120202020000 1;
120200000000 1;
100002020202 1;
100202000202 1;
120202020202 1;
120002020202 1;
120200000000 1;
120002000202 1;
100002000202 1;
100200000000 1;
120000020202 1;
120002020002 1;
120202000200 1;
120202020202 1;
120202020002 1;
120200020200 1;
120200020202 1;
120000000000 1;
120202020002 1;
120202020202 1;
120202000002 1;
120202020200 1;
120002020202 1;
100202020202 1;
120202020002 1;
100202020002 1;
100202000202 1;
120002000202 1;
120202020200 1;
120202020002 1;
100200000000 1;
120200000000 1;
120202020002 1;
120000000000 1;
120200020200 1;
100000000000 1;
120200020200 1;
120200020200 1;
100200020000 1;
120200000000 1;
120202020200 1;
120200020000 1;
120202000202 1;
120200020202 1;
120200000000 1;
120202020202 1;
120202020200 1;
120202020200 1;
120202020202 1;
120202020202 1;
120202000000 1;
120002020200 1;
120000000000 1;
120000000000 1;
120200020202 1;
100200020002 1;
120000000000 1;
120202020000 1;
120202020000 1;
120200000000 1;
120002020202 1;
120002020000 1;
120202020202 1;
120202020202 1;
120002020200 1;
120202020200 1;
120202020002 1;
120202000000 1;
120202020200 1;
120202020202 1;
100002020202 1;
120000000000 1;
120200000202 1;
100002000200 1;
120202020202 1;
120002020200 1;
100200020202 1;
120202020202 1;
120002020202 1;
120200020200 1;
120002020202 1;
100202020202 1;
120200000000 1;
120002000000 1;
100202020202 1;
100000000000 1;
120202020200 1;
100202020200 1;
120200000000 1;
120202000202 1;
120000000000 1;
100202020002 1;
100200000000 1;
100202000202 1;
120002000000 1;
120200000202 1;
120202020202 1;
120202020202 1;
120202020202 1;
100202020202 1;
120002020202 1;
120202020002 1;
100000000000 1;
120200000000 1;
100202020202 1;
120200020202 1;
120000000000 1;
120202000200 1;
120202000202 1;
120002020002 1;
120202020202 1;
120202020002 1;
120202020200 1;
120202000000 1;
120202020202 1;
100002000000 1;
100202000000 1;
120000000000 1;
120002000202 1;
120200000000 1;
120200000000 1;
100002020202 1;
120202000202 1;
120002020202 1;
120202020000 1;
120202020200 1;
120000000000 1;
120202020000 1;
120200000000 1;
100000000000 1;
120200000002 1;
120200020200 1;
100202020202 1;
120202020002 1;
100202020002 1;
120202000000 1;
120202020202 1;
120202020202 1;
120202020202 1;
120202000000 1;
120202020202 1;
120202020202 1;
120200000000 1;
120202000202 1;
100200000000 1;
120202000000 1;
120202000202 1;
100202000202 1;
120202000200 1;
120202020202 1;
100000000000 1;
120202020002 1;
120202020000 1;
120202020202 1;
120202020202 1;
120202020202 1;
120202020000 1;
120202020202 1;
100002020200 1;
120000020200 1;
120202000202 1;
100202020000 1;
120002020202 1;
120000000000 1;
120200020202 1;
120202020202 1;
120200020000 1;
120002020200 1;
120200020202 1;
120202020200 1;
120000000000 1;
120202020200 1;
120202020002 1;
120202020202 1;
100202020202 1;
120202000200 1;
120202000202 1;
120002020202 1;
120200000000 1;
120200000000 1;
100002020000 1;
100202000000 1;
100202020200 1;
120000000000 1;
100002020000 1;
120200000000 1;
100002000000 1;
100200000000 1;
120202000000 1;
120200000000 1;
120202020000 1;
120202020202 1;
120002020200 1;
100202020000 1;
120202020000 1;
120000000000 1;
120202000200 1;
100000000000 1;
120000000000 1;
120202020202 1;
120202020002 1;
100202020202 1;
120002000200 1;
120202020000 1;
120002000000 1;
120000020002 1;
120000000000 1;
120202000202 1;
100002020202 1;
120200000000 1;
120202020200 1;
120202020202 1;
120202020202 1;
120202000000 1;
100202020000 1;
120200020200 1;
120202020202 1;
120002000000 1;
100200000202 1;
120202020202 1;
120202020000 1;
100002000202 1;
100002000200 1;
120202020002 1;
120202000002 1;
120202020200 1;
120000000000 1;
120202000202 1;
120000000202 1;
120202020202 1;
120200000000 1;
100000000000 1;
120202020000 1;
120200000000 1;
120000020202 1;
120202000202 1;
120202000200 1;
120202000000 1;
120000000000 1;
120202000202 1;
120202020200 1;
100200020200 1;
100202000000 1;
120000000000 1;
100000000000 1;
120200020000 1;
100202020002 1;
120000000000 1;
120002000000 1;
100000000000 1;
120202020202 1;
120202020002 1;
120202020202 1;
120202020000 1;
120202020200 1;
120202020202 1;
120202020200 1;
120002020202 1;
120202020000 1;
120200020202 1;
120202020202 1;
120202000202 1;
120002020202 1;
100002020202 1;
120202020000 1;
120202000202 1;
120200000000 1;
120200020202 1;
120202000000 1;
120200020202 1;
120200020002 1;
120000000000 1;
100202020000 1;
100202020202 1;
120202000202 1;
120200000000 1;
120000020202 1;
120202020202 1;
120000000202 1;
120200000000 1;
120200020002 1;
120200000000 1;
120202020202 1;
120000000000 1;
100000000000 1;
120202020000 1;
120000000000 1;
120202020002 1;
120202020200 1;
120202020202 1;
120202000002 1;
120202020000 1;
100000000000 1;
120202020200 1;
120200000000 1;
120200020000 1;
100202000202 1;
120202020200 1;
120202020202 1;
120202020202 1;
120200020202 1;
120202020002 1;
100000000000 1;
120202020200 1;
120000000000 1;
120202020202 1;
120200020202 1;
120202020202 1;
120202020202 1;
120002000002 1;
120202020202 1;
120200000000 1;
120202020202 1;
120202020202 1;
120200020002 1;
100002020000 1;
120202020202 1;
120202020002 1;
120202020202 1;
120200000000 1;
120202020202 1;
120202000000 1;
120202020000 1;
120002020202 1;
100202020202 1;
120200000000 1;
100202000200 1;
100202020202 1;
120000000000 1;
120202020202 1;
100200000000 1;
120002020000 1;
100200000000 1;
120202020202 1;
120002020002 1;
120200000002 1;
120202020202 1;
100202000000 1;
120202000000 1;
120200000000 1;
120202020202 1;
100202020202 1;
120202020202 1;
120202020002 1;
120202020202 1;
120200020000 1;
120202020200 1;
120202020202 1;
120200020200 1;
120002020202 1;
100202000200 1;
120202020202 1;
120002020202 1;
120000020202 1;
120000000000 1;
120202000002 1;
120002020202 1;
120202020202 1;
120202000000 1;
120202000000 1;
120202020202 1;
120202020202 1;
120202020202 1;
100000000000 1;
120000000000 1;
120202020202 1;
100202020200 1;
120202020200 1;
100200020202 1;
120200020202 1;
120202020202 1;
120202020202 1;
120000000000 1;
120000000002 1;
120000000000 1;
120002020202 1;
120202020202 1;
100200020202 1;
120202000202 1;
120202020202 1;
100000000000 1;
120202000000 1;
120002020200 1;
120202020002 1;
120000000000 1;
120002020002 1;
120202020202 1;
120202020200 1;
120202020202 1;
100200020202 1;
120202020002 1;
120002020000 1;
120202020202 1;
120000000000 1;
100200020202 1;
120202020000 1;
120202000000 1;
120002020202 1;
120202000000 1;
120000020002 1;
100202020200 1;
120202020200 1;
120202000202 1;
100000000000 1;
100202020200 1;
120202000202 1;
120200000000 1;
120202000000 1;
120000000000 1;
120202020202 1;
120202020000 1;
120202020000 1;
100000000000 1;
120202020202 1;
120202020000 1;
120202020202 1;
120202000000 1;
120002020002 1;
120002020202 1;
120202000000 1;
100200020202 1;
100000000000 1;
100202020200 1;
120202020002 1;
120202020200 1;
120202000202 1;
120202020002 1;
120202000002 1;
120202020202 1;
120202000200 1;
120200000000 1;
120202020202 1;
120202020200 1;
100200000000 1;
120202020200 1;
120002020202 1;
120202020202 1;
120000000000 1;
120202000002 1;
120202020202 1;
120202020200 1;
120202020000 1;
120002020200 1;
120202020202 1;
120202020200 1;
120202020202 1;
120202020202 1;
100000000000 1;
120000000000 1;
120202020202 1;
120200000000 1;
100202000000 1;
120202020200 1;
100000000000 1;
120202020202 1;
100002020000 1;
120200000000 1;
120202020202 1;
120000000000 1;
120202000202 1;
120000000000 1;
120202000000 1;
120202020202 1;
120202020200 1;
120002020202 1;
120000000000 1;
120202020200 1;
100202020200 1;
120202020002 1;
100202000000 1;
120202020202 1;
120202020202 1;
120200000002 1;
120002020002 1;
120202020202 1;
100200000000 1;
120202020200 1;
120000000000 1;
120202000202 1;
120202020202 1;
100202020200 1;
120000000000 1;
120000000000 1;
120202020202 1;
100002000202 1;
120202020000 1;
120202020200 1;
120200000000 1;
120202020202 1;
120202020202 1;
120200000000 1;
120202020200 1;
100202000000 1;
120202000000 1;
120000000000 1;
100200020200 1;
120002000200 1;
120202020202 1;
120000000000 1;
120000000000 1;
120002020202 1;
100000000000 1;
100002020202 1;
100000000000 1;
120000000000 1;
120002020002 1;
120202020202 1;
120202020202 1;
120002020000 1;
120202020200 1;
100202020202 1;
120202020200 1;
120202020202 1;
120202020002 1;
120202020202 1;
120200000000 1;
120000000000 1;
100000000000 1;
100002020202 1;
120200020200 1;
120202020202 1;
100000000000 1;
120200000000 1;
120000000000 1;
120202020202 1;
120202000000 1;
120200000202 1;
120202020200 1;
120002000000 1;
120200000000 1;
120000000000 1;
120000000000 1;
120000000000 1;
120200020202 1;
120202020202 1;
120202020202 1;
120202020000 1;
120202020202 1;
100202000002 1;
100202020202 1;
120200000000 1;
120202020202 1;
120202020002 1;
100000000000 1;
100002020202 1;
120202020202 1;
100200020202 1;
120202020202 1;
120200000000 1;
120000000000 1;
120000000000 1;
100000000000 1;
120002000000 1;
120202020002 1;
120202000200 1;
120002020202 1;
120002000202 1;
120200000000 1;
120202000200 1;
120200020202 1;
120200020002 1;
120002020202 1;
100200000000 1;
120202020200 1;
120200020200 1;
100202020202 1;
120202020002 1;
100000000000 1;
100200020200 1;
120202020202 1;
120202020200 1;
120202000000 1;
120002020200 1;
100202020202 1;
120202020002 1;
120202000202 1;
120200000000 1;
120202020202 1;
120202020000 1;
100200020202 1;
120202020000 1;
120202020000 1;
100000000000 1;
120202020202 1;
120202000200 1;
120200020002 1;
120202020202 1;
120200020202 1;
120202000002 1;
120000000000 1;
100002020202 1;
100202020000 1;
120200020202 1;
120002020202 1;
120200020000 1;
100000000000 1;
120002020000 1;
120202000202 1;
120202000202 1;
100202020202 1;
120202020000 1;
120202020202 1;
120002000002 1;
120002000000 1;
120202020200 1;
120000020202 1;
100202000000 1;
120202020202 1;
120002000202 1;
120000000000 1;
120202020202 1;
120200000202 1;
120000000000 1;
120200020200 1;
120202020202 1;
120002020002 1;
120202020202 1;
120002020202 1;
120202020200 1;
120202020202 1;
100200020200 1;
120202020002 1;
100202020000 1;
120202020202 1;
120202020002 1;
120002020202 1;
100002020202 1;
100202020200 1;
120000000000 1;
120200000000 1;
100000000000 1;
120202020202 1;
100002020202 1;
100200020202 1;
120202000202 1;
120002000202 1;
120000000000 1;
120200020202 1;
120202020202 1;
120200000000 1;
120000000000 1;
120202000000 1;
120000000000 1;
120202020202 1;
100202020200 1;
120202020200 1;
120202020202 1;
120202000000 1;
120002000202 1;
100202020000 1;
120200000000 1;
120202000000 1;
120202000000 1;
100000020000 1;
120202020000 1;
120202020202 1;
100000000000 1;
120202020202 1;
120202020202 1;
120202000000 1;
120202020202 1;
100202000202 1;
100200020202 1;
120200000000 1;
120202020200 1;
100202000200 1;
120200000200 1;
120200000000 1;
100202020202 1;
120202020000 1;
120202000000 1;
100202020200 1;
120000000000 1;
120002020200 1;
120000000000 1;
120200000000 1;
120000020200 1;
120202020200 1;
100002020202 1;
120202020002 1;
120000020200 1;
100000000000 1;
120002020002 1;
120202020200 1;
100202000000 1;
120002020000 1;
120000000000 1;
120200000000 1;
120200000000 1;
100200000000 1;
100002000202 1;
120200020202 1;
120202000000 1;
100202020202 1;
120200000000 1;
120202020202 1;
100000000000 1;
120000000000 1;
120202020000 1;
120200020202 1;
120202020200 1;
120202000000 1;
120202020202 1;
120000000000 1;
120000000202 1;
120202000202 1;
120202020202 1;
120202020202 1;
120000000000 1;
120000020202 1;
120202020002 1;
120200020200 1;
120200000000 1;
120202020000 1;
120202020202 1;
120202000202 1;
100200000000 1;
120202020200 1;
120202000000 1;
120202020202 1;
120202020202 1;
100202020202 1;
120200020202 1;
120202020202 1;
120002020202 1;
100000000000 1;
120202020202 1;
120002020200 1;
100000000000 1;
100000000000 1;
120000000000 1;
120200000000 1;
120202020202 1;
120202000200 1;
100000000000 1;
100202000202 1;
120202020200 1;
120202020202 1;
120200000000 1;
120200020002 1;
120200000000 1;
120202020000 1;
100002000202 1;
100000000000 1;
120202020002 1;
100000000000 1;
120202000000 1;
120202020000 1;
100202020202 1;
100000000000 1;
120202020002 1;
120000000000 1;
120202020202 1;
120200020200 1;
120200000000 1;
120200020002 1;
120202000202 1;
100002000202 1;
120002020000 1;
120202020202 1;
120202020000 1;
100000000000 1;
120000000000 1;
120202020202 1;
120000020202 1;
100202000000 1;
120000020200 1;
120200000202 1;
120000000202 1;
100202020202 1;
120202000002 1;
120202020200 1;
120202020202 1;
120202020202 1;
120002020000 1;
120200020202 1;
120202020200 1;
120002020200 1;
120200020202 1;
120202020200 1;
120000000000 1;
120202020202 1;
120000000000 1;
120200020200 1;
120202000000 1;
120202000202 1;
120202000202 1;
120202000002 1;
120202020202 1;
120202000202 1;
120200000000 1;
120202020202 1;
120200020000 1;
100000000000 1;
120200000000 1;
120002000002 1;
120000000000 1;
120202020002 1;
120202000000 1;
120002000000 1;
120202000202 1;
120002000000 1;
120200000000 1;
120200000000 1;
120000000202 1;
120202020202 1;
120202020000 1;
120202000000 1;
120202000202 1;
120202020200 1;
120000020000 1;
120200000000 1;
120202020200 1;
120000000000 1;
120200020202 1;
100202020202 1;
120002000200 1;
120202020200 1;
120200020202 1;
120000000000 1;
120202020002 1;
120202020200 1;
100200020200 1;
120202020202 1;
120202020202 1;
100200000200 1;
100000000000 1;
120000000000 1;
120000000000 1;
120202020002 1;
120200000000 1;
100000000000 1;
120200020202 1;
120200020202 1;
120200000000 1;
120002020202 1;
120202020000 1;
120202020202 1;
120002020202 1;
120202020202 1;
100000000000 1;
120202020202 1;
100202020202 1;
100202000200 1;
100202000200 1;
120202020202 1;
120202000002 1;
100202000202 1;
120202020002 1;
120200020002 1;
120002020200 1;
100202020200 1;
120202020000 1;
120002020200 1;
120202000000 1;
100002000000 1;
120202020200 1;
120202020202 1;
120202020202 1;
100002020002 1;
120202020202 1;
120202020002 1;
120200000000 1;
120202000000 1;
120202000000 1;
120202000000 1;
120202020202 1;
120202000202 1;
120000000000 1;
120200000000 1;
120000000000 1;
120200000000 1;
100202020000 1;
120202000000 1;
120202000200 1;
120202000000 1;
120202020202 1;
120202020000 1;
100000000000 1;
120000020202 1;
120200000000 1;
120202020202 1;
120002000200 1;
100202000000 1;
120000000000 1;
100000000000 1;
120000000000 1;
120202020202 1;
120202000002 1;
100202020000 1;
100000000000 1;
120200020202 1;
100000000000 1;
120202020202 1;
120200020200 1;
100002020200 1;
120002000202 1;
120202020202 1;
120202020000 1;
120002020200 1;
120202000202 1;
120202000000 1;
100000000000 1;
120000000000 1;
120202020000 1;
120200000000 1;
100202000200 1;
120202020202 1;
120200020002 1;
120000000000 1;
120202020200 1;
100202020202 1;
120002020202 1;
120000020000 1;
120002020202 1;
120000020000 1;
120202020200 1;
120200020200 1;
100000000000 1;
120002020200 1;
120000000000 1;
120002020200 1;
100202020202 1;
120000000000 1;
120200000000 1;
100200020202 1;
120202020200 1;
120202020202 1;
120200000000 1;
100000000000 1;
120200000202 1;
120202020000 1;
100000000000 1;
120202000000 1;
120200000202 1;
120200020000 1;
100202000200 1;
120202020202 1;
120202020000 1;
120202020202 1;
120202020202 1;
120202020202 1;
100000000000 1;
100200000000 1;
120202000000 1;
120200000000 1;
120000000000 1;
120000000000 1;
120202000000 1;
120002020202 1;
120202020000 1;
120002020002 1;
120000020202 1;
proc estimate link=Logit NOLOOP varest=2ndPart ;
model={ S(~1)p(~1)r(~1)R(~1)R'(~1)F(~1)F'(~1) };
fixed=1;
parm(6)=0 ;
group=1 S rows=6 cols=6 Triang ;
1 1 1 1 1 1 ;
1 1 1 1 1 ;
1 1 1 1 ;
1 1 1 ;
1 1 ;
1 ;
group=1 p rows=5 cols=5 Triang ;
6 6 6 6 6 ;
6 6 6 6 ;
6 6 6 ;
6 6 ;
6 ;
group=1 r rows=6 cols=6 Triang ;
6 6 6 6 6 6 ;
6 6 6 6 6 ;
6 6 6 6 ;
6 6 6 ;
6 6 ;
6 ;
group=1 R rows=6 cols=6 Triang ;
2 2 2 2 2 2 ;
2 2 2 2 2 ;
2 2 2 2 ;
2 2 2 ;
2 2 ;
2 ;
group=1 R' rows=6 cols=6 Triang ;
3 3 3 3 3 3 ;
3 3 3 3 3 ;
3 3 3 3 ;
3 3 3 ;
3 3 ;
3 ;
group=1 F rows=5 cols=5 Triang ;
4 4 4 4 4 ;
4 4 4 4 ;
4 4 4 ;
4 4 ;
4 ;
group=1 F' rows=5 cols=5 Triang ;
5 5 5 5 5 ;
5 5 5 5 ;
5 5 5 ;
5 5 ;
5 ;
design matrix constraints=6 covariates=7;
1 0 0 0 0 0 0;
0 0 0 1 0 0 0;
0 0 0 0 1 0 0;
0 0 0 0 0 1 0;
0 0 0 0 0 0 1;
0 1 0 0 0 0 0;
blabel(1)=S:(Intercept);
blabel(2)=p:(Intercept);
blabel(3)=r:(Intercept);
blabel(4)=R:(Intercept);
blabel(5)=RPrime:(Intercept);
blabel(6)=F:(Intercept);
blabel(7)=FPrime:(Intercept);
rlabel(1)=S g1 c1 a0 t1;
rlabel(2)=R g1 c1 a0 t1;
rlabel(3)=R' g1 c1 a0 t1;
rlabel(4)=F g1 c1 a0 t1;
rlabel(5)=F' g1 c1 a0 t1;
rlabel(6)=p g1 c1 a1 t2;
proc stop;
"
Snook
 
Posts: 14
Joined: Tue Dec 02, 2008 12:05 am
Location: Florida

Re: Error in if (x4 > x2) { : argument is of length zero

Postby tommyg » Wed Apr 13, 2011 12:52 pm

See this page: viewtopic.php?f=21&t=1778.

Since this is a simulation and you know the "truth", you may want to give mark some initial values. The jitter function in R is a nice way to "jitter" a value if you're concerned about giving the estimation routine too much information by starting it out at the true value.

Some if statements within your loop might be used to prevent the loop from crashing as well as the function R function try. Also turning setting silent=TRUE in mark suppresses errors which should prevent you from getting kicked out of the loop.

Good luck.
tommyg
 
Posts: 21
Joined: Tue Mar 01, 2011 1:55 pm

Re: Error in if (x4 > x2) { : argument is of length zero

Postby Snook » Wed Apr 13, 2011 1:30 pm

Yes, I had seen that but might think it would be inappropriate to use the prior knowledge from the simulation to initialize the parameters, as I am testing the performance of the Barker model under a variety of assumption violating conditions.

I tried the silent command, and it did remove the error message, but a message still came up saying the model did not run, which still ended the loop.

However, I found a potential fix, although I am not sure why it is working. Originally, I had set p and r = 0 as there is a 0% chance of physically recapturing a fish. When I removed this constriction, the loop crashes stopped (so far), and the Barker estimates these parameters as near-zero numbers (10^-9 or so).


I will post if any further developments occur.

Thanks!
Snook
 
Posts: 14
Joined: Tue Dec 02, 2008 12:05 am
Location: Florida

Re: Error in if (x4 > x2) { : argument is of length zero

Postby ganghis » Wed Apr 13, 2011 3:54 pm

There's a couple of things I noticed about your input file. First, the design matrix appeared to have on all zero column, which means that there's a beta that's not being used anywhere. Second, with incidental observations only, I don't think it will be possible to estimate the F and F' parameters - you'll need to fix those. This is because the information used to estimate emigration really comes from the difference between apparent survival "estimated" from recaptures only, which happen in a limited area, and true survival "estimated" from recoveries, which are assumed to happen everywhere. I can't remember whether the Barker model has incidental observations happening 'everywhere' or in a limited area, but in either case emigration won't be identifiable. This is likely the reason your simulations are unstable.

Cheers, Paul
ganghis
 
Posts: 84
Joined: Tue Aug 10, 2004 2:05 pm

Re: Error in if (x4 > x2) { : argument is of length zero

Postby jlaake » Thu Apr 14, 2011 12:43 am

There is nothing wrong with TommyG's suggestion to use the parameter values for the simulation as starting values. All you are doing is helping the optimization. You aren't influencing the estimates it will derive. But as the Paul's post points out there is a problem with what you are trying to do. I'm mostly concerned with the all 0 column which should not happen as the code is supposed to delete those columns. What was the R code you used to create the mark run that you showed in your first post. I don't care about the data but what calls you used to process.data, make.design.data and mark.

To avoid crashes in a situation like this, you should explore the try function in R which lets you trap and test for errors. It will help you avoid the problem but it sounds like the root of the problem is something else.

--jeff
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Error in if (x4 > x2) { : argument is of length zero

Postby Snook » Thu Apr 14, 2011 11:57 am

Here is the code I used to run the Barker on the capture history called: BARKER.ch
"
BARKER.processed <- process.data(BARKER.ch,model="Barker")
BARKER.dll <- make.design.data(BARKER.processed)
r.0<-list(formula=~1,fixed=0)
p.0<-list(formula=~1,fixed=0)

BARKER<-mark(BARKER.ch,model="Barker",delete=TRUE,model.parameters=list(r=r.0,p=p.0))
"

Also, I am interested in Paul's second point, and am curious about everyone's opinion on this. This point is especially important as, in my current simulation, there is no emigration (only survival and capture), so I can fix these parameters on that basis alone. My interpretation of these parameters are:

F=Probabily at risk of capture in i and i+1. As there is no emigration, I would imagine this parameter could be fixed to = 1. However, does the fact that if an animal at risk of capture at i dies between i and i+1 it is no longer at risk of capture in i+1 change how this would have to be fixed?F

F' = prob not at risk of capture in i but at risk of capture in i+1. There is no emigration in this simulation, so animals alive are always at risk of capture. I am trying to determine if that means F' would be fixed at 0, since if an animal is not at risk of capture, it must be dead and therefore can't be caught in i+1.


I would also like to thank everyone for their replies and help with this, the Barker is much bulkier than the CJS!!
Snook
 
Posts: 14
Joined: Tue Dec 02, 2008 12:05 am
Location: Florida

Re: Error in if (x4 > x2) { : argument is of length zero

Postby ganghis » Thu Apr 14, 2011 12:17 pm

Hi,

Set F=1 and F' to whatever you want... it won't contribute to the likelihood with F=1.

Paul
ganghis
 
Posts: 84
Joined: Tue Aug 10, 2004 2:05 pm

Re: Error in if (x4 > x2) { : argument is of length zero

Postby jlaake » Thu Apr 14, 2011 1:13 pm

I ran the example data with the model of your original post and it converged fine but as Paul pointed out it cannot estimate F and F'. The reason for the all 0 column is because both r and p are set to same value of 0. This does not matter because both are fixed and the beta for columns 2 and 3 are not used because those are the ones for the fixed parameters. You can test that by setting fixed=1e-12 for one of the parameters and you'll get the same values for the estimable parameters. Not sure why it did not converge for you. Are you using the most recent MARK version?
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA


Return to RMark

Who is online

Users browsing this forum: No registered users and 2 guests

cron