globals [ ;; INPUTS ;; Parameters that a user might consider changing ;landscape size is determined manually by adjusting map on Interface time ; integer indicating maximum number of generations in the simulation (set to 5000) stabledif ; cutoff below which changes in population size among subsequent decades are considered negligible (possible range 0-1; set to 0.1) H ; number between 0-1 indicating spatial autocorrelation of habitat (set to 0.5) ;amount of habitat is randomly selected under "new-cover" reporter below (selected from uniform distribution between 0.05 and 0.95) focal-patch-radius ; radius of focal area (set to 7 cells) initialp ; proportion of cells that have an occupant before the model starts. Used to determine initialN. (set to 10%) meansteps ; mean number of steps in an exponential distribution. Used to define "energy" a turtle-level parameter (set to 9) habCRW ; degree to which subsequent moves are correlated (set to 0.9; possible range 0-1) matCRW ; degree to which subsequent moves are correlated when in matrix (set equal to habCRW) deltastep ; additive increase in step size when in matrix relative to step size when in habitat (set to 0) vary-step? ; logical indicating whether step sizes of individuals are drawn from a random distribution or whether they are all the same (set to TRUE) moveprob ; probability that a juvenile will disperse (set to 1; possible range 0-1) habK ; carrying capacity of a habitat cell (set to 2; possible range >= 0) setprob ; probability of settlement, given that the settlement rule has been met (set to 1; possible range 0-1) ;; Inner Workings Parameters additions ; parameter used in midpoint-displacement algorithm (set to TRUE) sigma ; parameter used in midpoint-displacement algorithm (set to 1) ;; Landscape Decorations bgcolor ; matrix color fgcolor ; habitat color fpcolor ; focal area color (same properties as habitat, but significant because this is the location of the census) ;; Individual Decorations critcolor ; color of individuals focalcritcolor ; color of individuals in focal area (same properties as other individuals, but significant because they are counted in year end census) ;; OUTPUTS ;; landscape this-seed ; the random seed real-cover ; % cover selected randomly real-H ; fragmentation (default is that it is 0.5) r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 ; buffer radii (max 10 buffers, units = cells) c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 ; buffer cover (% breeding habitat) g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 ; gap sizes within each buffer ;; focal area population N_10yr N1 N1t-1 N1t-2 N1t-3 N1t-4 N1t-5 N1t-6 N1t-7 N1t-8 N1t-9 ; abundance in focal area for previous 10 years B0 B0t-1 D1 E1 S1 I1 O1 ; demographic parameters in focal area Idists Idist25 Idistmed Idist75 Idistmax Ihcoef;; distance from which immigrants moved fpnfail fpnsucc fpmed_time fpmed_mattime fpmed_dist fpmax_time fpmax_mattime fpmax_dist ; summary of movement success from the focal area fplambda ; growth rate in focal area ;; global population initialN ;; initial number of individuals nadults_10yr nadults nadultst-1 nadultst-2 nadultst-3 nadultst-4 nadultst-5 nadultst-6 nadultst-7 nadultst-8 nadultst-9 ; abundance in entire landscape for previous 10 years dists distmin dist02.5 dist25 distmed dist75 disth95 distmax distmean hcoef; dispersal kernel for global population timemin time02.5 time25 timemed time75 time97.5 timemax timemean ; number of steps for global population nmove nfail nsucc psucc ; movement success of global population lambda ; global population growth rate ;; TOOLS (variables that act as counters or contain temporary information) this-radius ;; buffer output step;; counter for steps settlep ;; density and habitat dependent probability of settlement numhatch ; number of offspring per individual landscape lastx lasty lasttype ; information on each move stable? n100list sd100 ;nadults over a 50 year time span like? ;; whether a individual accepts a boundary crossing buffer-num ; counter for buffers mn-gap-size; temporary variable giving mean gap size run-num ; run number alphahab E_lambda_hab ; variables used to calculate settlement probability ] breed [individuals individual] ;; create the individual extensions [array] ;; allow lists ;; attributes of patches patches-own [ breedhab? ;; indicates if the cell is breeding habitat hab-neighbors ;; counts how many neighboring cells are breeding habitat countdown-breedhab ;; the time until a matrix cell turns into a breeding cell countdown-matrix ;; the time until a breeding cell turns into a matrix cell ] ;; attributes of individuals turtles-own [ energy ;; Energy level per individual (potential number of steps taken during lifetime) drawn from exponential distribution natalx nataly ;; natal cell age; 0 or 1 mover? ;; is this individual going to move anymore? pathtime ;; individuals time spent moving when ending outside of focal area netdisplacement ;; straight line distance to final location outside of focal area mattime ;; time spent moving in matrix ] ;; -------------------- setup -------------------- ;; to setup reset-timer clear-all ;; clear landscape ; Set-up Landscape Constants set time 5000 set stabledif 0.1 set focal-patch-radius 7 set H 0.5 set additions TRUE set sigma 1.0 set habCRW 0.9 set matCRW habCRW set deltastep 0 set vary-step? TRUE set habK 2 set moveprob 1 set setprob 1 ;; Landscape Decorations set bgcolor 9.9 ; matrix color set fgcolor 135 ; habitat color set fpcolor 125 ; focal area color (same properties as habitat, but significant because this is the location of the census) ifelse behaviorspace-run-number > 0 [ set run-num behaviorspace-run-number set save-output? TRUE ][ set run-num user-run-num ] ;; delete old output file if starting a new experiment if run-num = 1 AND save-output? [if file-exists? (word directory filename experiment ".csv")[ file-delete (word directory filename experiment ".csv")]] ifelse set-seed? = true [ set this-seed seed ][ set this-seed new-seed ] random-seed this-seed ; use midpoint displacement algorith to set up a fractal landscape setup-fractal add-center-patch setup-individuals end ;; -------------------- go -------------------- ;; ;;-----;; Yearly Routine ;;-----;; to go ; Kill Adults kill-adults ; Move Juveniles movement ; Mature and Reproduce reproduce tick post-breeding-census update-plot ;; update figure if ticks >= time OR not any? individuals OR stable? [ show (word " run " run-num " " date-and-time " timer " timer " nadults " nadults " ticks " ticks) if save-output? [print-output] ;; save-output? is a manually selected logical by the user or is automatically set to TRUE if behaviorspace is used if save-map? [print-map] ;; print map stop ] end ;; ---------------- SUBROUTINES ------------------------;; ;; --- Saupe midpoint displacement algorithm --- ;; to setup-fractal ifelse vary-cover? [ set real-cover new-cover ; randomly select cover ][ set real-cover user-cover ; user determined cover ] set real-H H let delta sigma set landscape array:from-list n-values (N + 1) [array:from-list n-values (N + 1) [0]] ; set the initial random corners set-val landscape 0 0 random-normal 0 delta set-val landscape 0 N random-normal 0 delta set-val landscape N 0 random-normal 0 delta set-val landscape N N random-normal 0 delta let bigd N let smalld N / 2 let stage 1 ; stage of fractal process (total of maxlevel) let x smalld ; column id let y smalld ; row id repeat maxlevel [ ; going from grid type I to type II set delta (delta * 0.5 ^ (0.5 * real-H)) set x smalld ; interpolate and offset points repeat ((((N - smalld) - smalld)) / bigd) [ set y smalld repeat ((((N - smalld) - smalld)) / bigd) [ set-val landscape x y (f4 delta (get-val landscape (x + smalld) (y + smalld)) (get-val landscape (x + smalld) (y - smalld)) (get-val landscape (x - smalld) (y + smalld)) (get-val landscape (x - smalld) (y - smalld))) set y (y + bigd) ] set x (x + bigd) ] ; displace other points also if needed set x 0 if additions [ repeat ((N + 1) / bigd) [ set y 0 repeat ((N + 1) / bigd) [ set-val landscape x y ((get-val landscape x y) + random-normal 0 delta ) set y (y + bigd) ] ; end repeat y set x (x + bigd) ] ; end repeat x ] ; end if ; grid type II to grid type I set delta (delta * 0.5 ^ (0.5 * real-H)) ; interpolate and offset boundary grid points set x smalld repeat ((N - smalld) - smalld ) / bigd [ set-val landscape x 0 (f3 delta (get-val landscape (x + smalld) 0) (get-val landscape (x - smalld) 0) (get-val landscape x smalld) ) set-val landscape x N (f3 delta (get-val landscape (x + smalld) N) (get-val landscape (x - smalld) N) (get-val landscape x (N - smalld)) ) set-val landscape 0 x (f3 delta (get-val landscape 0 (x + smalld)) (get-val landscape 0 (x - smalld)) (get-val landscape smalld x) ) set-val landscape N x (f3 delta (get-val landscape N (x + smalld)) (get-val landscape N (x - smalld)) (get-val landscape (N - smalld) x) ) set x (x + bigd) ] ; end repeat x ; interpolate and offset interior grid points set x smalld repeat ((N - smalld) - smalld ) / bigd [ set y bigd repeat ((N - smalld) - bigd ) / bigd [ set-val landscape x y (f4 delta (get-val landscape x (y - smalld)) (get-val landscape x (y - smalld)) (get-val landscape (x + smalld) y) (get-val landscape (x - smalld) y)) set y (y + bigd) ] ; end repeat y set x (x + bigd) ] ; end repeat x; set x bigd repeat ((N - smalld) - bigd ) / bigd [ set y smalld repeat ((N - smalld) - smalld ) / bigd [ set-val landscape x y (f4 delta (get-val landscape x (y - smalld)) (get-val landscape x (y - smalld)) (get-val landscape (x + smalld) y) (get-val landscape (x - smalld) y)) set y (y + bigd) ] ; end repeat y set x (x + bigd) ] ; end repeat x ; displace other points also if needed if additions [ set x 0 repeat ((N + 1) / bigd) [ set y 0 repeat ((N + 1) / bigd) [ set-val landscape x y (get-val landscape x y + random-normal 0 delta) set y y + bigd ] ; end repeat y set x x + bigd ] ; end repeat x set x smalld repeat (((N - smalld) - smalld) / bigd) [ set y smalld repeat (((N - smalld) - smalld) / bigd) [ set-val landscape x y (get-val landscape x y + random-normal 0 delta) set y y + bigd ] ; end repeat y set x x + bigd ] ; end repeat x ] ; end if additions set bigd bigd / 2 set smalld smalld / 2 set stage stage + 1 ] ; end repeat maxlevel ; find value of habitat/non-habitat let mylist [0] set x 0 repeat (N + 1) [ set y 0 repeat (N + 1) [ set mylist lput get-val landscape x y mylist set y y + 1 ] set x x + 1 ] set mylist sort mylist let index item round ( real-cover * (N + 1) * (N + 1) ) mylist ; place landscape into grid set x 0 repeat (max-pxcor * 2 + 1) [ set y 0 repeat (max-pycor * 2 + 1) [ ask patches with [pxcor = (x - max-pxcor) and pycor = (y - max-pycor)] [ ifelse (get-val landscape x y) < index [ set pcolor fgcolor ] [set pcolor bgcolor] ] ; end ask patches set y y + 1 ] ; end cols set x x + 1 ] ; end rows end ; setup-fractal to-report new-H report 1 / ( 1 + exp(-1 * (random-normal ln(H / (1 - H)) 0.25))) end to-report new-cover report (random-float 0.90) + 0.05 end to-report maxlevel report ceiling log( 2 * max-pxcor + 1) 2 end to-report N report 2 ^ maxlevel end to-report get-val [ %a #col #row] report array:item (array:item %a #row) #col end to-report f3 [sd x0 x1 x2] report (x0 + x1 + x2) / 3 + random-normal 0 sd end to-report f4 [sd x0 x1 x2 x3] report (x0 + x1 + x2 + x3) / 4 + random-normal 0 sd end to set-val [ %a #col #row #val ] array:set (array:item %a #row) #col #val end to add-center-patch ask focal-cell [ ask focal-patch [set pcolor fpcolor] ] end to setup-individuals ;; landscape constants set initialp 10 set meansteps 9 ;; Individual Decorations set critcolor 0; color of individuals set focalcritcolor 55; color of individuals in focal area (same properties as other individuals, but significant because they are counted in year end census) set-default-shape individuals "dot" set initialN (initialP / 100) * count patches create-individuals initialN ;; create the individuals, then initialize their variables [ set color critcolor set size 1 set label-color yellow - 2 setxy random-xcor random-ycor ;; assign random locations set age 0 ] ask focal-cell [ set B0t-1 0 set N1t-1 0 set N1t-2 0 set N1t-3 0 set N1t-4 0 set N1t-5 0 set N1t-6 0 set N1t-7 0 set N1t-8 0 set N1t-9 0 ask focal-individuals [ set shape "bug" set color focalcritcolor ] ] ;initialize n10s set stable? FALSE set n100list [0 0 0 0 0 0 0 0 0 0] post-breeding-census land-output end ;; -------------------- go -------------------- ;; to post-breeding-census ;; FOCAL AREA OUTCOMES - many different outcomes meant to keep track of the population in the focal area ; abundance of adults in the focal area for the previous 10 years set N1t-9 N1t-8 set N1t-8 N1t-7 set N1t-7 N1t-6 set N1t-6 N1t-5 set N1t-5 N1t-4 set N1t-4 N1t-3 set N1t-3 N1t-2 set N1t-2 N1t-1 set N1t-1 N1 ;; adults only set N1 count individuals with [ pcolor = fpcolor AND age = 1 ] ;; abundance of adults in focal area this generation set N_10yr (N1 + N1t-1 + N1t-2 + N1t-3 + N1t-4 + N1t-5 + N1t-6 + N1t-7 + N1t-8 + N1t-9) / 10 ;; average abundance in focal area over the last 10 years ; births, fidelity, emigrants, immigrants, deaths, and occupancy in focal area set B0t-1 B0 ; number of juveniles in focal area last generation set B0 count individuals with [age = 0 AND pcolor = fpcolor] ; number of juveniles in focal area this generation set S1 count individuals with [age = 1 AND pcolor = fpcolor AND color = focalcritcolor] ; number of adults in focal area this generation who started out in the focal area set E1 count individuals with [age = 1 AND pcolor > fpcolor AND color = focalcritcolor] ;; number of adults who started out in the focal area but ended up elsewhere set I1 count individuals with [age = 1 AND pcolor = fpcolor AND color = critcolor] ;; number of adults who started out elsewhere and ended up in the focal area set D1 count individuals with [age = 1 AND pcolor < fpcolor AND color = focalcritcolor] ;; number of adults who started out in the focal area but ended up elsewhere ifelse N1 > 0 [ set O1 1][ set O1 0 ] ;; presence/absence of adults in focal area ;; growth rate in focal area ifelse N1t-1 > 0[ set fplambda (N1 - N1t-1 ) / N1t-1 ][ set fplambda 0 ] ;; distances from which immigrants in focal area moved ifelse I1 > 0 [ ; if there are immigrants set Idists sort [netdisplacement] of individuals with [age = 1 AND pcolor = fpcolor AND color = critcolor] set Idist25 item floor(0.25 * I1) Idists ; 25th percentile dispersal distance set Idistmed item floor(0.50 * I1) Idists ; 50th percentile dispersal distance (median) set Idist75 item floor(0.75 * I1) Idists ; 75th percentile dispersal distance set Idistmax max Idists ; maximum dispersal distance set Ihcoef (Idist75 + (Idist75 - Idist25) * 1.5) ;; These are the maximum whiskers on a boxplot as created in R and based on Tukey (1977) Exploratory Data Analysis ][ set Idist25 0 set Idistmed 0 set Idist75 0 set Idistmax 0 set Ihcoef 0 ] ;; summarize focal area movers distances set fpnfail count individuals with [color = focalcritcolor AND pcolor < fpcolor AND age = 1] ;; adult emigrants set fpnsucc count individuals with [color = focalcritcolor AND pcolor > fpcolor AND age = 1] ;; adult emigrants ifelse E1 > 0 [ set fpmed_time median [pathtime] of individuals with [age = 1 AND color = focalcritcolor AND pcolor != fpcolor] set fpmed_mattime median [mattime] of individuals with [age = 1 AND color = focalcritcolor AND pcolor != fpcolor] set fpmed_dist median [netdisplacement] of individuals with [age = 1 AND color = focalcritcolor AND pcolor != fpcolor] set fpmax_time median [pathtime] of individuals with [age = 1 AND color = focalcritcolor AND pcolor != fpcolor] set fpmax_mattime median [mattime] of individuals with [age = 1 AND color = focalcritcolor AND pcolor != fpcolor] set fpmax_dist median [netdisplacement] of individuals with [age = 1 AND color = focalcritcolor AND pcolor != fpcolor] ][ set fpmed_time 0 set fpmed_mattime 0 set fpmed_dist 0 set fpmax_time 0 set fpmax_mattime 0 set fpmax_dist 0 ] ;; GLOBAL OUTCOMES - outcomes meant to keep track of the global population set nadultst-9 nadultst-8 set nadultst-8 nadultst-7 set nadultst-7 nadultst-6 set nadultst-6 nadultst-5 set nadultst-5 nadultst-4 set nadultst-4 nadultst-3 set nadultst-3 nadultst-2 set nadultst-2 nadultst-1 set nadultst-1 nadults ;; adults only set nadults ( count individuals with [age = 1] ) set nadults_10yr (nadults + nadultst-1 + nadultst-2 + nadultst-3 + nadultst-4 + nadultst-5 + nadultst-6 + nadultst-7 + nadultst-8 + nadultst-9) / 10 ;; summarize all movers distances set nmove count individuals with [age = 1 AND netdisplacement > 0] set nfail count individuals with [age = 1 AND netdisplacement > 0 AND pcolor < fpcolor] set nsucc count individuals with [age = 1 AND netdisplacement > 0 and pcolor >= fpcolor] ifelse nmove > 0 [ set psucc (nsucc / nmove) set dists sort [netdisplacement] of individuals with [age = 1 AND netdisplacement > 0] set distmin min dists set dist02.5 item floor(0.025 * nmove) dists set dist02.5 item floor(0.025 * nmove) dists set dist25 item floor(0.25 * nmove) dists set distmed item floor(0.50 * nmove) dists set dist75 item floor(0.75 * nmove) dists set disth95 item floor(0.975 * nmove) dists set distmax max dists set distmean mean dists set hcoef (dist75 + (dist75 - dist25) * 1.5) ;; These are the maximum whiskers on a boxplot as created in R and based on Tukey (1977) Exploratory Data Analysis let times sort [pathtime] of individuals with [age = 1 AND netdisplacement > 0] set timemin min times set time02.5 item floor(0.025 * nmove) times set time02.5 item floor(0.025 * nmove) times set time25 item floor(0.25 * nmove) times set timemed item floor(0.50 * nmove) times set time75 item floor(0.75 * nmove) times set time97.5 item floor(0.975 * nmove) times set timemax max times set timemean mean times ][ set psucc 0 set distmin 0 set dist02.5 0 set dist02.5 0 set dist25 0 set distmed 0 set dist75 0 set disth95 0 set distmax 0 set distmean 0 set hcoef 0 let times 0 set timemin 0 set time02.5 0 set time02.5 0 set time25 0 set timemed 0 set time75 0 set time97.5 0 set timemax 0 set timemean 0 ] ; overall if count individuals with [age = 1 AND pcolor >= fpcolor] > 0 [ set lambda count individuals with [age = 0] / count individuals with [age = 1] ] ; nadults over 100 year time span if (ticks / 10) = (round (ticks / 10)) AND ticks != 0 [ set n100list remove-item 0 n100list set n100list lput nadults n100list set sd100 ( max n100list - min n100list ) / max n100list if sd100 < stabledif [set stable? true] ] ask individuals with [pcolor = fpcolor] [ set shape "bug" set color focalcritcolor ] end ;; post-breeding-census to kill-adults ;; death of those age > 0 ask individuals with [age = 1] [die] end to movement ;; individual movement ask individuals [;; loop through individuals if mover? = true [;; is this individual qualified to move? (i.e. is the individual a juvenile and has not moved before) set step 0 ;; keep track of step number starting with 0 move ;; move ] set age 1 ;; when individual is finished moving, it become an adult ] end ;; individual movement to move repeat energy [ ;; loop through steps (allowed to move a certain number of steps determined at birth) if mover? = true [ ;; if still qualified to move (i.e. has not settled yet) record-position ;; record location set like? false ;; set acceptance of the next step to false try-steps ;; go through a set of possible steps until an acceptable one is found and then take that step consider-settlement ;; if settlement conditions are met, then settle if pcolor < fpcolor [ set mattime mattime + 1 ] set pathtime step + 1 set netdisplacement sqrt( (natalx - xcor) ^ 2 + (nataly - ycor) ^ 2) ] set step step + 1 ] end to record-position ; record current position set lasttype pcolor set lastx xcor set lasty ycor end ;; record-position to try-steps while [like? = false][ ; keep trying steps until one of them is acceptable (steps are only unacceptable if they cross an unacceptable boundary) choose-direction take-a-step respond-to-boundary ] end to choose-direction ; Pick a direction ifelse step = 0 [ ;; first move set heading random 360 ;; randomly select a direction in a full 360 uniform distribution ][ ;; wrapped cauchy distribution (equation from Fletcher 2006, see good explanation in Barton et al 2009) ifelse pcolor >= fpcolor [ set heading ( heading + 2 * atan (( (1 - habCRW) / (1 + habCRW ) ) * tan(pi * ( random-float 1 - 0.5 ))) 1) ][ set heading ( heading + 2 * atan (( (1 - matCRW) / (1 + matCRW ) ) * tan(pi * ( random-float 1 - 0.5 ))) 1) ];; find direction ];; pick a direction end ;; choose-direction to take-a-step ; pick a step length and move ifelse pcolor >= fpcolor [ ifelse vary-step?[ fd random-exponential habstep ][ fd habstep ]; end if varied ][ ifelse vary-step?[ fd random-exponential (habstep + deltastep) ][ fd habstep ]; end if varied ] end ;; take-a-step to respond-to-boundary ; if in new habitat type OR at boundary of landscape ifelse ( lasttype >= fpcolor ) AND pcolor < fpcolor [ ;if move from habitat to matrix ifelse random-float 1 > matprob [ ; if rejecting matrix then return to previous position and select a new heading and do not count as a step set xcor lastx set ycor lasty set heading (heading + random-float 180) ; turn around ][ set like? true ; stay there! ] ][ set like? true ; end if hab change ] ifelse (xcor < min-pxcor OR xcor > max-pxcor OR ycor < min-pycor OR ycor > max-pycor) [ ; WHAT IT SHOULD BE: ifelse (xcor <= (min-pxcor + 1) OR xcor >= (max-pxcor - 1) OR ycor <= (min-pycor + 1) OR ycor >= (max-pycor - 1)) [ set xcor lastx set ycor lasty set heading (heading + random-float 180) ; turn around set like? false ][ set like? true ] end;; boundary response to consider-settlement ; consider settlement if settlerule = "random" [ set settlep 0] ; do not settle until energy has been used up if settlerule = "habitat" [ ; if in matrix, set the settlement probability to 0, otherwise, set the settlement probability to setprob (default = 1) ifelse pcolor < fpcolor [set settlep 0][set settlep setprob] ] if settlerule = "empty habitat" [ ; if in matrix or if the cell is occupied, set the settlement probability to 0, otherwise, set the settlement probability to setprob (default = 1) ifelse pcolor < fpcolor OR count turtles-here > 1 [set settlep 0][set settlep setprob] ] if random-float 1 <= settlep [ ; if a random number between 0-1 is less than the settlement probability, then settle (switch mover? to false) set mover? false ] end;; consider-settlement to reproduce ;; individual reproduction define-growth ;; based on the reproductive rate (growth), the carrying capacity (habk), and the number of adults in the cell, determine the average number of offspring per individual in this cell ask individuals [ ;; individual loop ifelse pcolor >= fpcolor [ ; if the individual is in a habitat cell, then produce a random number of offspring set numhatch random-poisson (growth / (1 + alphahab * count individuals-here with [age = 1]) ) ; based on Barton et al 2009 = contest competition ][ set numhatch 0 ; if the individual is in matrix, then no offspring ] hatch numhatch [ ;; create the offspring of this individual ifelse pcolor = fpcolor [ ;; if in focal area, make it look like a focal area individual set color focalcritcolor set shape "bug" ][ set color critcolor set shape "dot" ] ;; record age, natal location (x,y), time spent moving, time spent in matrix, ;; total net displacement, probability of emigration (default = 1), ;; and maximum number of steps the individual will be able to take set age 0 set natalx pxcor ; cell x set nataly pycor ; cell y set pathtime 0 set mattime 0 set netdisplacement 0 ifelse random-float 1 <= moveprob [ set mover? true ][ set mover? false ] set energy random-exponential meansteps ] ;; end hatch ] ;; end individual loop end to define-growth ;; based on the reproductive rate (growth), the carrying capacity (habk), and the number of adults in the cell, determine the average number of offspring per individual in this cell ifelse (habk > 0) [ set alphahab ((growth - 1 ) / habK) set E_lambda_hab (growth / (1 + alphahab)) ][ set alphahab 10000 set E_lambda_hab 0 ] end to update-plot ;; output numbers to a graph set-current-plot "Numbers" ;set-current-plot-pen "num-hab-patches" ;plot num-hab-patches set-current-plot-pen "nadults" plot nadults end to-report focal-individuals report individuals with [pcolor = fpcolor] end to land-output ;;buffer output ; radii set r1 0 set r2 0 set r3 0 set r4 0 set r5 0 set r6 0 set r7 0 set r8 0 set r9 0 set r10 0 ; cover set c1 0 set c2 0 set c3 0 set c4 0 set c5 0 set c6 0 set c7 0 set c8 0 set c9 0 set c10 0 ; average gap width set g1 0 set g2 0 set g3 0 set g4 0 set g5 0 set g6 0 set g7 0 set g8 0 set g9 0 set g10 0 ;; buffer 1 set buffer-num 1 set this-radius radius-min if this-radius > max-pxcor [stop] ask focal-cell [ set c1 ( count buffer-hab / count buffer-all ) set r1 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g1 mn-gap-size ] ;; end ask focal-cel ;; buffer 2 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c2 ( count buffer-hab / count buffer-all ) set r2 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g2 mn-gap-size ] ;; end ask focal-cell ;; buffer 3 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c3 ( count buffer-hab / count buffer-all ) set r3 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g3 mn-gap-size ] ;; end ask focal-cell ;; buffer 4 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c4 ( count buffer-hab / count buffer-all ) set r4 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g4 mn-gap-size ] ;; end ask focal-cell) ;; buffer 5 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c5 ( count buffer-hab / count buffer-all ) set r5 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g5 mn-gap-size ] ;; end ask focal-cell ;; buffer 6 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c6 ( count buffer-hab / count buffer-all ) set r6 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g6 mn-gap-size ] ;; end ask focal-cell ;; buffer 7 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c7 ( count buffer-hab / count buffer-all ) set r7 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g7 mn-gap-size ] ;; end ask focal-cell ;; buffer 8 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c8 ( count buffer-hab / count buffer-all ) set r8 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g8 mn-gap-size ] ;; end ask focal-cell ;; buffer 9 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c9 ( count buffer-hab / count buffer-all ) set r9 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g9 mn-gap-size ] ;; end ask focal-cell ;; buffer 10 set buffer-num buffer-num + 1 set this-radius this-radius + radius-increment if this-radius > max-pxcor [stop] ask focal-cell [ set c10 ( count buffer-hab / count buffer-all ) set r10 this-radius ask patches in-radius this-radius with [pcolor = bgcolor] [set pcolor 8 + ( buffer-num * 10 )] measure-gap set g10 mn-gap-size ] ;; end ask focal-cell end to measure-gap let last-cell TRUE let total-gap-size 0 let ngaps 0 set mn-gap-size 0 let sample-direction 0 repeat 4 [ ; take 4 samples of gaps in the 4 directions let new-radius this-radius while [new-radius > 0] [ ask patch-at-heading-and-distance sample-direction new-radius [ if pcolor < fpcolor AND last-cell = FALSE [ ; add to old gap set total-gap-size total-gap-size + 1 ] if pcolor < fpcolor AND last-cell = TRUE [ ; start a new gap set total-gap-size total-gap-size + 1 set ngaps ngaps + 1 set last-cell FALSE ] if pcolor >= fpcolor AND last-cell = FALSE [ ; finish this gap set last-cell TRUE ] set new-radius new-radius - 1 ; increments are equal to a single cell ;if pcolor < fpcolor [set pcolor 86] ;if pcolor > fpcolor [ set pcolor fgcolor + 3] ] ; end ask patch ] ; end while loop set sample-direction sample-direction + 90 ] ; end repeat loop ifelse ngaps > 0 [ set mn-gap-size (total-gap-size / ngaps) ][ set mn-gap-size 0 ] end to-report radius-max report max-pxcor end to-report radius-min report (focal-patch-radius + 2) end to-report radius-increment report round ( (radius-max - radius-min) / 9 ) end to-report nbuffers report 10 end to-report focal-cell report patches with [pxcor = 0 and pycor = 0] end to-report focal-patch report patches in-radius focal-patch-radius end to-report buffer-all report patches in-radius this-radius end to-report buffer-hab report patches in-radius this-radius with [pcolor >= fpcolor] end to-report max-hab-patches report round ( real-cover * count patches) end ;; what is the maximum number of breeding habitat cells to-report num-hab-patches report count patches with [pcolor >= fpcolor] end to-report pcover report num-hab-patches / count patches end ;; ------------------- Output --------------------------- ;;; to print-map set-current-directory directory if save-map? [export-view (word "map" filename experiment run-num ".png")] end to print-output set-current-directory directory if run-num = 1 [ ;; open file and print header file-open (word directory filename experiment ".csv") ;; INPUT HEADERS file-type (word "INPUTS,") ;; general file-type (word "run-num,max-pxcor,max-pycor,min-pxcor,min-pycor,filename,experiment,save-map?,seed,set-seed?,") ;; land_settings file-type (word "focal-patch-radius,initialP,radius-max,stabledif,time,") ;; landscape file-type (word "additions,H,sigma,") ;; species file-type (word "meansteps,habCRW,habK,habstep,setprob,vary-step?,growth,moveprob,deltastep,matCRW,matprob,") ;; OUTPUT HEADERS file-type (word "OUTPUTS,") ;; LANDSCAPE LEVEL REPORTERS ;; landscape file-type (word "this-seed,timer,real-cover,pcover,num-hab-patches,real-H,") ;; population file-type (word "nadults_10yr,nadults,") ;; movement file-type (word "nmove,nfail,nsucc,psucc,") file-type (word "distmin,dist02.5,dist25,distmed,dist75,disth95,distmax,distmean,hcoef,") file-type (word "timemin,time02.5,time25,timemed,time75,time97.5,timemax,timemean,") ;; FOCAL AREA REPORTERS ;; population file-type (word "N_10yr,N1,I1,O1,B0,B0t-1,D1,E1,S1,") ;;movement file-type (word "Idist25,Idistmed,Idist75,Idistmax,") file-type (word "Ihcoef,") ;; buffer radii file-type (word "r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,") ;; buffer cover file-type (word "c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,") ;; buffer average gap size file-type (word "g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,") file-print "" file-close ] file-open (word directory filename experiment ".csv") ;; INPUT HEADERS file-type (word ",") ;; general file-type (word run-num "," max-pxcor "," max-pycor "," min-pxcor "," min-pycor "," filename "," experiment "," save-map? "," seed "," set-seed? ",") ;; land_settings file-type (word focal-patch-radius "," initialP "," radius-max "," stabledif "," time ",") ;; landscape file-type (word additions "," H "," sigma ",") ;; species file-type (word meansteps "," habCRW "," habK "," habstep "," setprob "," vary-step? "," growth "," moveprob "," deltastep "," matCRW ","matprob "," ) ;; OUTPUT HEADERS file-type (word "," ) ;; LANDSCAPE LEVEL REPORTERS ;; landscape file-type (word this-seed "," timer "," real-cover "," pcover "," num-hab-patches "," real-H "," ) ;; population file-type (word nadults_10yr "," nadults ",") ;; movement file-type (word nmove "," nfail "," nsucc "," psucc "," ) file-type (word distmin "," dist02.5 "," dist25 "," distmed "," dist75 "," disth95 "," distmax "," distmean "," hcoef ",") file-type (word timemin "," time02.5 "," time25 "," timemed "," time75 "," time97.5 "," timemax "," timemean "," ) ;; FOCAL AREA REPORTERS ;; population file-type (word N_10yr "," N1 "," I1 "," O1 "," B0 "," B0t-1 "," D1 "," E1 "," S1 "," ) ;;movement file-type (word Idist25 "," Idistmed "," Idist75 "," Idistmax ",") file-type (word Ihcoef ",") ;; buffer radii file-type (word r1 "," r2 "," r3 "," r4 "," r5 "," r6 "," r7 "," r8 "," r9 "," r10 "," ) ;; buffer cover file-type (word c1 "," c2 "," c3 "," c4 "," c5 "," c6 "," c7 "," c8 "," c9 "," c10 "," ) ;; buffer average gap size file-type (word g1 "," g2 "," g3 "," g4 "," g5 "," g6 "," g7 "," g8 "," g9 "," g10 "," ) file-print "" file-close end @#$#@#$#@ GRAPHICS-WINDOW 678 159 1228 730 67 67 4.0 1 10 1 1 1 0 0 0 1 -67 67 -67 67 1 1 1 ticks BUTTON 188 15 257 48 go-forever go T 1 T OBSERVER NIL NIL NIL NIL MONITOR 31 685 81 730 pcover pcover 2 1 11 PLOT 678 14 1196 152 Numbers time number 0.0 10.0 0.0 10.0 true false PENS "nadults" 1.0 0 -16777216 true SLIDER 155 84 388 117 habstep habstep 0 15 2 0.1 1 NIL HORIZONTAL SLIDER 155 118 388 151 growth growth 0.5 10 1.5 0.5 1 NIL HORIZONTAL MONITOR 180 635 230 680 nadults nadults 0 1 11 BUTTON 54 15 109 48 setup setup NIL 1 T OBSERVER NIL NIL NIL NIL MONITOR 31 635 81 680 N1 N1 2 1 11 SLIDER 155 199 388 232 matprob matprob 0 1 1 1 1 NIL HORIZONTAL BUTTON 121 15 176 48 NIL go NIL 1 T OBSERVER NIL NIL NIL NIL MONITOR 89 685 139 730 c1 c1 2 1 11 MONITOR 138 685 188 730 c2 c2 2 1 11 MONITOR 188 685 238 730 c3 c3 2 1 11 MONITOR 238 685 288 730 c4 c4 2 1 11 MONITOR 288 685 338 730 c5 c5 2 1 11 MONITOR 338 685 388 730 c6 c6 2 1 11 MONITOR 387 685 437 730 c7 c7 2 1 11 MONITOR 436 685 486 730 c8 c8 2 1 11 MONITOR 536 685 586 730 c10 c10 2 1 11 MONITOR 486 685 536 730 c9 c9 2 1 11 SWITCH 151 373 331 406 set-seed? set-seed? 1 1 -1000 SLIDER 151 340 331 373 seed seed -9007199254740992 9007199254740992 -15 1 1 NIL HORIZONTAL MONITOR 151 294 331 339 this-seed this-seed 0 1 11 SWITCH 24 294 140 327 save-map? save-map? 1 1 -1000 INPUTBOX 24 359 141 419 directory c:\\ 1 0 String INPUTBOX 24 479 142 539 experiment _test1 1 0 String MONITOR 81 635 131 680 distmed distmed 2 1 11 MONITOR 130 635 180 680 distmax distmax 2 1 11 CHOOSER 155 152 388 197 settlerule settlerule "random" "habitat" "empty habitat" 0 INPUTBOX 24 419 141 479 filename traitscape 1 0 String TEXTBOX 36 69 147 237 Input Parameters\n\nMovement Step Size\n\nReproductive Rate\n\nSettlement Rule\n\n\nProbability of Entering the Matrix\n(Gap-avoidant = 0) 11 0.0 1 TEXTBOX 31 277 135 295 Output Files 11 0.0 1 TEXTBOX 155 274 305 292 Random seed options 11 0.0 1 TEXTBOX 32 613 182 631 Main Output 11 0.0 1 SWITCH 24 327 140 360 save-output? save-output? 1 1 -1000 SWITCH 436 130 608 163 vary-cover? vary-cover? 0 1 -1000 SLIDER 436 162 608 195 user-cover user-cover 0.05 0.95 0.75 0.05 1 NIL HORIZONTAL SLIDER 24 539 142 572 user-run-num user-run-num 1 1000 1 1 1 NIL HORIZONTAL @#$#@#$#@ OUR ORIGINAL PURPOSE ----------- We developed a simulation model ("TraitScape") that simulates dynamics of hypothetical species in hypothetical landscapes. For a given species type (characterized by a fully factorial set of species parameters, see "input parameter values that were experimentally varied"), we conducted multiple simulation runs, each in a different landscape. We then analyzed the set of runs to determine the scale of effect of landscape structure on population abundance for that species type. To make our results as useful as possible for field researchers, we constructed the simulations such that the output data were the same as what would be collected by field ecologists conducting a "focal patch" landscape-scale study (Brennan et al. 2002), i.e., where the response variable (e.g. population abundance) is measured at the centers of multiple sites and the predictors are landscape structure variables (e.g. habitat amount) measured in the landscapes surrounding the focal sites. By conducting multiple sets of simulations, with different values for the parameters that determine species type, we tested the predictions that dispersal distance, reproductive rate, and movement behavior should influence the scale of effect of the landscape, and we quantified their effects. In addition, we used information concerning secondary outcomes (e.g. population size, shape of dispersal kernel, variation among runs in average dispersal distances) collected from each treatment combination to explore the mechanisms linking dispersal distance, reproductive rate, and movement behavior to scale of effect. authors: Heather Bird Jackson heather.b.jackson@gmail.com and Lenore Fahrig WHAT YOU CAN DO This program allows an investigator to test hypotheses concerning the effect of three species traits (dispersal distance, reproductive rate, and movement behavior) on abundance within a focal area. The output includes information about habitat cover in 10 concentric rings and abundance of individuals in the focal area. These data can be used to calculate the scale of effect, or the distance from the center of a focal area at which habitat cover is most associated with abundance in the focal area. PROCEDURE SUMMARY Model Description TraitScape is an individual-based spatially-explicit model. In TraitScape, individuals represent generic mobile animals and are defined by four state variables: original position (x0, y0), current position (x, y), age (0 or 1), and energy level (lifetime number of movement steps possible). Original position and energy are determined at birth, current position is updated after each movement step, and age is updated once a year. Default simulations are run in a 127 X 127 grid with reflective boundaries (see "other input parameters that can be adjusted in procedures"). This grid size is large enough to allow ten potential scales of effect (concentric radii from 9-63 cells), but small enough to keep the global population at a computationally manageable size (generally < 20,000 individuals). The odd number of cells (127 X 127) is an artifact of the midpoint displacement algorithm (Saupe 1988) which is used to generate naturalistic random landscapes (see “Submodels”). Grid cell size does not represent an absolute spatial unit (e.g. meters); instead, the size of grid cells is only meaningful with respect to the step size of individuals which can vary with user input. Grid cells are the finest grain at which habitat type is categorized. Density-dependence in reproduction and settlement (when applicable) is modeled within grid cells. Grid cells are classified as either suitable habitat (hereafter “habitat”) or unsuitable habitat (hereafter “matrix”). To simplify our model, we did not explicitly model mortality during movement, whether in matrix or habitat. All adults die at the end of reproduction. Therefore, if an individual settles in the matrix it dies without reproducing. Individuals with informed movement behavior (see "Input parameter values that can be experimentally varied") are responsive to cell type during settlement and/or movement, and are consequently less likely to settle in matrix. The model proceeds in time steps, which we call "years" and which are equivalent to generations. In order to allow populations to stabilize, each run lasts up to 5000 years. Most runs are much shorter because a run is ended when the global population size reaches a steady state (i.e. if population size varies by less than 10% from decade to decade for at least 10 decades) or when the global population goes extinct. TraitScape simulates the yearly processes of adult death, juvenile movement (which ends in maturation), and adult reproduction, in that order. Each process is completed before the next process begins. Within each process, each individual fully completes its action (e.g. movement) before the next randomly selected individual initiates action. Within years, time is not explicitly represented; instead each process continues until completion and then the next process immediately begins. Submodels Setup An individual simulation run begins by setting up a random landscape using the midpoint displacement algorithm (Saupe 1988). This algorithm produces realistic-looking landscapes and allows independent control of the amount of habitat and the configuration of habitat (for examples see Saupe 1988; With and King 1999). The algorithm creates fractal landscapes which can vary in the amount of spatial autocorrelation according to the parameter H. The fractal dimension (D) of the landscape is a property of H such that D = 3 - H. The main difference among landscapes in our runs is the amount of habitat, not the configuration of habitat. H is held constant at 0.5 (moderate spatial autocorrelation, see "other input parameters that can be adjusted in procedures"), but the amount of habitat is randomly selected at the beginning of each run from a uniform distribution between 5% and 95%. Once a random landscape is generated, a focal area is added to its center. The focal area is the sampling area within which population abundance is sampled. To keep local conditions constant among runs, the focal area is always 100% habitat. Its radius is 7 cells (see "other input parameters that can be adjusted in procedures"). At the beginning of a simulation run, individuals are placed randomly in the landscape; runs begin with 1612 individuals (1 for every ten grid cells, see "other input parameters that can be adjusted in procedures"). Random distribution of individuals without regard for habitat ensures that the initial density of individuals in breeding habitat is independent of the amount of habitat in the landscape (Fahrig 2001). All starting individuals are juveniles. After initial setup, the model runs on a yearly time step with four main submodels: adult death, juvenile movement, and adult reproduction. Adult Death At the beginning of each year, all adults die (see "other input parameters that can be adjusted in procedures"). Juvenile Movement Movement is modeled one individual at a time. Each individual takes successive steps until settlement occurs. Before each step, an exploratory loop cycles through possible steps until an acceptable step (i.e. one in which no forbidden steps are made) is randomly drawn. A step outside of the grid is always forbidden. With DHSG, a step into the matrix is always forbidden. Like many animals (Kareiva and Shigesada 1983), model individuals move according to a correlated random walk. In a correlated random walk subsequent movement directions are correlated such that highly correlated movement paths are nearly straight (Turchin 1998). In the model, the initial direction of movement for each individual is selected randomly from between 0 and 2? radians. Thereafter, the direction of a step is drawn from a wrapped Cauchy distribution with a mean direction equal to the previous direction (see "other input parameters that can be adjusted in procedures", Fletcher 2006). The concentration around the mean direction is determined by ?, where ?=0 results in a random walk and ?=1 results in a perfectly straight line. For our simulations, we fixed ? at 0.90 (nearly straight) which is close to the optimal linearity for finding new habitat (Barton et al. 2009; Fletcher 2006; Zollner and Lima 1999, see "other input parameters that can be adjusted in procedures"). Each step length is drawn from a negative exponential distribution with a mean determined by the experimental treatment (range = 0.1 – 15.0 cells, see "Input parameter values that can be experimentally varied"). We manipulated average dispersal distances by altering step length rather than number of steps because theory suggests that body size is associated with space use (e.g. home range size) via its influence on step size or sampling scale (Jetz et al. 2004; Ritchie 2010). After a step is taken, an individual considers settlement (the end of dispersal). The choice to settle depends on (a) the number of steps already taken and, for most treatments, (b) the conditions in the cell. The maximum number of steps possible for each individual is assigned at birth, and an individual must settle once the maximum number of steps has been reached even if it is in matrix. The number of steps is drawn from a negative-exponential distribution with a mean of 9 for all runs in our simulations. With RS, the only reason an individual settles is that it has reached the maximum number of steps assigned at birth, but in other treatments, conditions in the cell can cause movement to stop earlier. With HS, individuals stop at the first habitat cell they encounter. With DHS and DHSG, individuals stop at the first habitat cell they encounter that is not occupied by another individual. Once an individual has settled, its status is changed from juvenile to adult and it no longer has the opportunity to move. Both step size and number of steps are drawn from negative exponential distributions to produce negative-exponentially distributed dispersal distances (straight-line distance between origin and settlement). A negative-exponential distribution is a common method used to model “fat-tailed” dispersal, or more long-distance dispersal than expected under a Gaussian distribution (e.g. Chapman et al. 2007; Kot et al. 1996). Fat-tailed dispersal is exhibited by many species in nature (Okubo 1980; Turchin 1998). Reproduction If settled in habitat, an adult has the opportunity to reproduce, with the number of offspring governed by logistic growth (see also Barton et al. 2009). The number of offspring per individual is drawn from a Poisson distribution (the distribution commonly used for simulating stochastic fecundity, Akçakaya 1991) with a mean determined by reproductive rate, the carrying capacity for a cell (k = 2 in our runs), and the density of individuals within a cell (see "Input parameter values that can be experimentally varied") DEFINITIONS Focal area: Survey area at center of landscape which consists of 100% breeding habitat. Not necessarily a "patch" in the metapopulation sense because it may or may not be isolated from breeding habitat. Rather, the focal area is simply the area within which population processes are scrutinized. This area is colored dark pink at the center of the landscape. Scale of effect: The size of the landscape from the perspective of the focal population, i.e. the distance from the center of a focal area at which habitat cover is most associated with abundance in the focal area. The scale of effect is not calculated in this program, but should instead be calculated using the output. To find the scale at which habitat cover is most associated with abundance in the focal area, one can calculate one of three measures of fit between abundance in the focal area and habitat cover at each scale: 1) the correlation coefficient, 2) the coefficient of determination (R-squared), or 3) AIC (Akaike's Information Criterion). INPUT PARAMETERS THAT CAN BE EXPERIMENTALLY VARIED Movement step size (habstep): Determines the average step size for each move. The length of each step is drawn from a random exponential distribution with a mean of "habstep". Reproductive rate (growth): The average number of offspring per individual.Individuals are asexual in this model. The actual number of births is drawn from a Poisson distribution with a mean that is determined by growth/[1 + Na*(growth + 1)/habk], where Na is the number of adults in a cell and habk is the carrying capacity of a cell (held constant at 2). This model assumes contest competition. Movement behavior (settlerule and matprob): The rules that guide settlement and movement of individuals. There are three possible settlement rules: "random", "habitat", and "empty habitat". "Random" dispersers do not stop moving until they have moved the maximum number of moves (energy - a value assigned at birth and drawn from an exponential distribution with mean of 9). "Habitat" dispersers settle in the first habitat cell encountered during dispersal. "Empty habitat" dispersers settle in the first habitat cell encountered that is not occupied by an adult. Matprob is a continuous variable that determines the probability that an individual will accept a possible step into the matrix. Matprob = 0 makes all individuals completely gap-avoidant, whereas matprob = 1 makes all individuals completely insensitive to gaps during movement. Habitat cover (inputs: user-cover, vary-cover?): Proportion of landscape cells which are breeding habitat. The default is for the program to randomly select the amount of cover from between 0.05 and 0.95. The user can control habitat cover by setting vary-cover? to NO, and adjusting user-cover to the desired amount. OTHER INPUT PARAMETERS THAT CAN BE ADJUSTED IN PROCEDURES Landscape size: the size of a landscape can be adjusted manually on the Interface. The default is 127 X 127 cells. Length of run (time, stabledif): Time determines the maximum length of a run. The default is 5000 generations. Runs are stopped earlier if a) global extinction occurs or b) population size varies by less than stabledif (default = 10%) every 10 years for 100 years (time default = 5000, possible values >= 1; stabledif default = 0.1, possible values = 0-1). Spatial autocorrelation of habitat (H): The degree of clumpiness of habitat cells; The opposite of habitat fragmentation. Given the same habitat cover, low H (as low as 0) will result in many small patches and low interpatch distances, whereas high H (up to 1) will result in a few large patches with high average interpatch distances (default = 0.5, possible values = 0-1). Size of focal area (focal-patch-radius): The default radius of the focal area is 7 cells (which makes 149 cells total). Initial ratio of individuals to cells (initialp): the default is 0.1, so that an average of 10% of cells contain an individual at the beginning. Individuals are randomly placed throughout the landscape so that the initial distribution of individuals is independent of habitat. Average energy level per individual (meansteps): at birth, an energy level (energy) is assigned to each individual. This determines the maximum number of steps that individual will be able to take. This value is drawn from a random exponential distribution with a mean of meansteps (default = 9; possible values >= 1). Correlation in the direction of successive moves (habCRW, matCRW): Individuals move according to the rules of a correlated random walk (Turchin 1998), which means that the direction of successive moves is correlated. The default correlation between successive directions is 0.9, with no difference in movement whether an individual is in habitat or matrix. The correlation within habitat and matrix can be changed by modifying habCRW and matCRW, respectively (default = 0; possible values = 0-1). Change in step size in the matrix (deltastep): The average step size in the matrix is calculated by habstep + deltastep. A user could make step sizes different in the matrix by changing deltastep from its default value of 0 (default = 0, possible values = -infinity - infinity). Variation in step sizes (vary-step?): A user could make all steps the same size by setting vary-step? to FALSE (default = TRUE). Probability of movement (moveprob): With default setting of moveprob = 1, each individual is assigned to the mover? = TRUE category at birth. This could be varied within the population if moveprob is set to a lower value (default = 1; possible values = 0-1). Carrying capacity of habitat cells (habk): the carrying capacity of habitat cells can be changed from its default of 2 (possible values >= 1). Probability of settlement when habitat rules are met (setprob): By default, individuals have a 100% chance of settling if habitat rules are met. This can become more variable by setting setprob to a lower value (default = 1, possible values = 0-1). MODEL OUTPUT DISPLAYED ON THE INTERFACE Abundance in focal area (N1): the number of adults in the focal area during the most recent post-breeding census. Dispersal distance (distmed, distmax): Total net displacement, or the straight-line distance between the natal location (x,y) and the settlement location (x,y). The average dispersal distance of individuals in a population can be changed by altering the average step length (habstep on the Interface). The distmed and distmax monitors on the Interface report the median and maximum dispersal distances for all individuals in the entire landscape. Abundance in entire landscape (nadults): the number of adults in the entire landscape during the post-breeding census. This value is also graphed in the plot above the landscape. Habitat cover (pcover, c1-c10): The actual amount of cover is reported for the entire landscape (pcover on the Interface monitor), and for the entire area within each concentric ring (c1 - c10 on the Interface monitor). OUTPUTS OFFERED WHEN SAVE-OUTPUT? = TRUE The outputs in this program are best designed to be used with BehaviorSpace. If the user wants to print outputs without using BehaviorSpace, then save-output? must be set to TRUE on the Interface. Outputs are saved to a .csv file in the "directory" under the file name that is the combination of "filename" and "experiment". The header is printed only when user-run-num is set to 1. *If user-run-num is set to 1, any data previously in the file by the same name will be erased. Change the file name or increase user-run-num to prevent previous data from getting erased.* The output from each run is recorded on a new line. User-run-num can be manually increased by the user in order to number runs, but the output will be printed even if the user-run-num is the same for successive runs. Inputs are recorded first and most have been described previously. Inputs include: run number (run-num), the coordinates for the corners of the landscape (max-pxcor, max-pycor, min-pxcor, min-pycor), the file name (filename), the experiment name (experiment), whether a map was saved (save-map?), the random number seed used for the run (seed), whether the seed was set by the user (set-seed?), radius of focal area (focal-patch-radius), proportion of cells initially occupied (initialP), radius of the largest concentric circle (radius-max), variation in abundance across decades below which the run is stopped (stabledif), maximum number of generations (time), settings for midpoint displacement algorithm (additions, H, sigma), correlation of successive moves (H), carrying capacity of habitat cells (habk), average step size (habstep), probability of settlement given that settlement rules are met (setprob), are step sizes drawn from a random exponential distribution (vary-step?), reproductive rate (growth), probability that an individual is assigned mover? status at birth (moveprob), change in step size relative to habitat in the matrix (deltastep), correlation in successive moves in the matrix (matCRW), probability that an individual will accept a move into the matrix (matprob). Outputs are recorded next. this-seed: the random number seed used for the run timer: the amount of time (minutes.seconds) that the run ran ;; -------------------- landscape attributes -------------------- ;; real-cover: the habitat cover randomly assigned to the landscape or by the user pcover: the actual amount of cover in the landscape (due to the random landscape algorithm, this can be slightly different from the assigned cover) num-hab-patches: the number of habitat cells in the landscape real-H: the autocorrelation parameter assigned to habitat cells in the landscape ;; -------------------- attributes of the global population -------------------- ;; nadults_10yr: the average number of adults in the entire landscape over the last 10 years nadults: the number of adults in the entire landscape in the last year nmove: the number of adults that moved to a different cell from their natal cell in the last year nfail: the number of adults that moved from their natal cell and settled in matrix nsucc: the number of adults that moved from their natal cell and settled in habitat psucc: the proportion of adults that moved from their natal cell and settled in habitat dist series: the distribution of dispersal distances of the entire population (distmin = minimum, dist02.5 = 2.5th percentile, dist25 = 25th percentile, distmed = median, dist75 = 75th percentile, dist97.5 = 97.5th percentile, distmax = maximum distance, distmean = mean distance, hcoef = whiskers on a boxplot based on Tukey (1977)) time series: the distribution of steps, i.e. the number of steps taken by individuals before settlement (timemin = minimum, time02.5 = 2.5th percentile, time25 = 25th percentile, timemed = median, time75 = 75th percentile, time97.5 = 97.5th percentile, timemax = maximum, timemean = mean) ;; -------------------- attributes of the focal population -------------------- ;; N_10yr: the average number of adults in the focal population for the last 10 years N1: the number of adults in the focal population in the last year I1: the number of adult immigrants into the focal population in the last year O1: presence of adults in the focal area in the last year B0: the number of juveniles in the focal area in the last year B0t-1: the number of juveniles in the focal area in the second to the last year D1: the number of individuals born in the focal area that moved out of the focal area and landed in matrix this year E1: the number of adults born in the focal area that moved out of the focal area and landed in habitat this year S1: the number of adults born in the focal area that stayed in the focal area this year Idist series: Dispersal distances of individuals that immigrated into the focal area (Idist25 = 25th percentile, Idistmed = 50th percentile, Idist75 = 75th percentile, Idistmax = maximum, Ihcoef = whiskers on a boxplot based on Tukey (1977)). ;; -------------------- attributes of focal area -------------------- ;; r1-r10: the radii of each concentric ring surrounding the focal area c1-c10: the proportion habitat cover in each concentric buffer surrounding the focal area g1-g10: the average gap size in each concentric buffer surrounding the focal area. This is calculated by measuring gaps in two transects: 1) top to bottom and intersecting with the center of the focal area, 2) left to right and intersecting with the center of the focal area. CREDITS AND REFERENCES ---------------------- Akçakaya HR (1991) A method for simulating demographic stochasticity. Ecological Modelling 54: 133-136 Barton KA, Phillips BL, Morales JM and Travis JMJ (2009) The evolution of an 'intelligent' dispersal strategy: biased, correlated random walks in patchy landscapes. Oikos 118: 309-319 Chapman DS, Dytham C and Oxford GS (2007) Modelling population redistribution in a leaf beetle: an evaluation of alternative dispersal functions. Journal of Animal Ecology 76: 36-44 Fahrig L (2001) How much habitat is enough? Biological Conservation 100: 65-74 Fletcher RJ (2006) Emergent properties of conspecific attraction in fragmented landscapes. American Naturalist 168: 207-219 Jetz W, Carbone C, Fulford J and Brown JH (2004) The scaling of animal space use. Science 306: 266-268 Kareiva PM and Shigesada N (1983) Analyzing insect movement as a correlated random-walk. Oecologia 56: 234-238 Kot M, Lewis MA and van den Driessche P (1996) Dispersal data and the spread of invading organisms. Ecology 77: 2027-2042 Okubo A (1980) Diffusion and ecological problems: mathematical models. Springer-Verlag, New York Ritchie ME (2010) Scale, Heterogeneity, and the Structure and Diversity of Ecological Communities. Princeton University Press, Princeton, NJ Saupe D (1988) Algorithms for random fractals. In Peitgen H.-O. and Saupe D. (eds.), The science of fractal images, pp. 71-113. Springer-Verlag, New York Turchin P (1998) Quantitative Analysis of Movement: Measuring and Modeling Population Redistribution in Animals and Plants. Sinauer Associates, Inc., Sunderland, Massachusetts With KA and King AW (1999) Extinction thresholds for species in fractal landscapes. Conservation Biology 13: 314-326 Zollner PA and Lima SL (1999) Search strategies for landscape-level interpatch movements. Ecology 80: 1019-1030 HOW TO CITE ----------- If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software: - Jackson, HB, Fahrig L (in press). What size is a biologically relevant landscape? Landscape Ecology - Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: - Copyright 2012 Heather Bird Jackson. All rights reserved. COPYRIGHT NOTICE ---------------- Copyright 2012 Heather Bird Jackson. All rights reserved. Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed: a) this copyright notice is included. b) this model will not be redistributed for profit without permission from Heather Bird Jackson. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 4.1.2 @#$#@#$#@ setup-random repeat 20 [ go ] @#$#@#$#@ @#$#@#$#@ setup go count turtles @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 1.0 0.0 0.0 1 1.0 0.0 0.2 0 1.0 0.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@