Mark Recapture Population Estimation

Some unknown number of salmon smolts (juvenile salmon) are swimming around in a lake.  They will with uniform probability wander into a pen adjoining the lake.  The gate can be closed, trapping the smolts and allowing them to be marked.  The marks are with PIT tags, so that the number of marked smolts in the pen can be counted in real time.  We assume that the total number in the pen can also be counted in real time, so that the applet has a continuously updated Lincoln-Peterson estimate and a refined Lincoln-Peterson estimate.

powered by NetLogo

view/download model file: MarkRecapture.nlogo


HOW TO USE IT

Hit Go to get started.  While Go is active, the gate can be opened and closed, and the smolts can be marked and counted. Hit Reset to randomly generate a new population of unmarked smolts.  Placing the cursor on a curve will reveal a population estimate for a given time.  When the gate is closed, the estimates remain constant.   How many smolts are in the lake? !!



THINGS TO NOTICE

First notice how the marked smolts must have time to leave the pen and become uniformly mixed in the lake population. An important observation may be how much variation there is in the population estimates. Also, notice how the variation narrows as more and more smolts are marked (hitting marked while the gate is closed will mark all the unmarked smolts in the pen).

 

RELATED MODELS

This model created by Dr. Jeff Knisley as part of the Symbiosis project module on migratory models in differential calculus. It is one of the simulations located at http://math.etsu.edu/symbiosis/migrations.


PROCEDURES

globals [ ActualSize Inited TotalFishInPen MarkedFishInPen TotalMarked XX ]

breed [ fishes fish ]

fishes-own [ IsMarked ]

to startup
   set Inited false ;
   Go
end

to Reset
  set Inited false ;
end

to Go
   if ( not Inited ) 
     [  ca
    
        ask patches [
          ifelse ( pxcor > -11 )   
            [ set pcolor blue ]
            [ if ( pycor > -6 and pycor < 6 ) 
               [ set pcolor blue ]
            ]
       ]   
       if Pop_Size = "Small" [ set ActualSize  120 ]
       if Pop_Size = "Medium" [ set ActualSize 420 ]
       if Pop_Size = "Large" [ set ActualSize  920 ] 
       if Pop_Size = "Random" [ set ActualSize  100 + random 900  ];
       if Pop_Size = "Keyed"  
          [ set ActualSize read-from-string user-input "Enter A 5 digit number: "
            ifelse(ActualSize > 9999 )
              [ set ActualSize  ActualSize * 3 mod 995 ]
              [ user-message "A Five digit number is required." 
                stop
              ]   
          ]      
       create-fishes ActualSize [
          set shape "fish"
          set IsMarked false 
          set color green
          rt random 90
          lt random 90
          setxy  ( ( random 30 ) - 10 ) random-ycor 
        ]
       set Inited true;
       set TotalMarked 0;
       set XX 0;
     ]
     ask patches with [ ( ( pxcor = -11 ) and ( pycor < 6 ) and ( pycor > -6 ) ) ] 
     [ 
        ifelse ( pycor > -6 + OpenGate ) 
          [ set pcolor grey ]
          [ set pcolor blue ] 
     ]
  move
end

to move
  tick
  ask fishes [
    ifelse ( can-move? 1 and ( ( [ pcolor ] of patch-ahead 1 ) = blue )) 
      [ fd 1 ]
      [ set heading ( heading + 90 * ( random 2  - 1 ) ) ]
      rt random 30
      lt random 30 
  ]
  set MarkedFishInPen count fishes with [ xcor < -11 and IsMarked ]
  set TotalFishInPen  count fishes with [ xcor < -11 ]
  
  if ( MarkedFishInPen > 0 ) 
    [ update-plot ]
  
end

to update-plot
  set XX ( XX + 1 )
  if ( XX > 99 ) 
    [ set XX 0 
      clear-plot 
    ]
  set-current-plot "Fish Population Estimates"
  set-current-plot-pen "Lincoln-Petersen"
  plotxy XX ( TotalFishInPen * TotalMarked / MarkedFishInPen )
  set-current-plot-pen "Chapman's Modification"
  plotxy XX ( ( TotalFishInPen + 1 ) * ( TotalMarked + 1 )  / ( MarkedFishInPen + 1 ) - 1 )
end

to mark
  ifelse ( OpenGate = 0 ) ; gate is closed
    [
       let MarkCount 0 
       ask fishes with [ xcor < -11  and ( not IsMarked )]
         [  
           if ( MarkCount <= ( NumberToMark - 1 ) ) 
             [
               set IsMarked true;
               set color red ;
               set MarkCount ( MarkCount + 1 )
             ]
         ]
       set TotalMarked count fishes with [ IsMarked ] ;
       output-print " "
       output-print " "
    ]
    [ output-print "Gate must be"
      output-print "closed" ]
end

to unmark
  ask fishes [ 
     set IsMarked false 
     set color green 
  ]
  set TotalMarked 0;
end