Model Dependency Bias

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.4.0 • Viewed 1 time • Downloaded 0 times • Run 0 times
Download the 'Model Dependency Bias' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This NetLogo model simulates a population of turtles (representing animals) living in two distinct habitats (A and B), divided by a vertical boundary. The key goal is to explore how different nutrition levels in each section of the environment affect the animals' survival, weight changes, and population dynamics. Animals forage for food, gain weight when they find it, and die if they go too long without eating. The model also tracks and displays various metrics such as animal population, average weight, and cumulative weight over time in each habitat.

HOW IT WORKS

The model operates based on the following rules:

Habitat Division: The world is divided into two sections, each representing a different habitat (A and B). Each section has a distinct nutritional level that influences the availability of food.

Animal Behavior: Fifty turtles (representing animals) are created in each habitat with an initial random weight, where the mean is 100 and the standard deviation is 10. Each habitat’s nutritional levels are established based on the inputs for Habitat-A-nutrition-level and Habitat-B-nutrition-level.

Turtles move randomly within their designated sections, consuming food when they encounter it and increasing their weight accordingly. Each turtle tracks the number of steps it takes without finding food. If this number exceeds a threshold of 10 steps, the turtle faces a risk of dying based on a probability that combines both starvation (with a 20% base probability of starvation) and weight factors (where lighter animals have a higher probability of death).

Food Availability: Patches of land are marked with food based on the nutritional levels defined by the user through sliders. The food can regrow over time, allowing for sustainable foraging. When a turtle consumes food from a patch, it depletes that patch and changes its color to signify that it no longer has food.

Population Dynamics: The model tracks the number of turtles in each habitat, their average weights, and the cumulative weight of the populations over time, displaying these metrics in plots.

HOW TO USE IT

To use the model, follow these instructions:

Interface:

Sliders: Adjust the Habitat-A-nutrition-level and Habitat-B-nutrition-level sliders to set the nutritional levels for each habitat. These levels influence how much food is available in each section.

Run Button: Click "setup" to initialize the environment and create turtles, then click "go" to start the simulation.

Plots: Observe the various plots tracking animal populations and average weights over time.

Turtle and Patch Interactions:

Turtles will forage for food on the patches. Observe how their weight changes as they find food and how their mortality rates vary based on food availability.

THINGS TO NOTICE

While running the model, consider the following possibilities:

Survivor Bias: In Habitat A, where the food level is lower, you might observe higher mortality rates among turtles. However, those that do survive could be heavier. This phenomenon arises from the model's design, where lighter animals have a greater probability of dying in both habitats. Consequently, in Habitat A, the scarcity of nutrients leads to a disproportionate death rate among lighter turtles. As a result, the survivors may have a higher weight compared to their counterparts in Habitat B. Conversely, while Habitat B may have a larger total biomass (total weight of all turtles), the weight of the surviving turtles in Habitat A might be greater due to the selective pressure favoring heavier individuals.

Competition for Food: In Habitat A, reduced food availability can lead to increased mortality rates. However, the survivors face less competition for resources, potentially allowing them to grow more rapidly compared to turtles in Habitat B, where food is more abundant but so is the population density. This dynamic could lead to slower growth rates among turtles in Habitat B due to higher competition for available food.

THINGS TO TRY

  • Experiment by modifying model inputs. For instance, set the Habitat-B-nutrition-level to 100%. Observe how this change impacts the turtles’ weight gain. It may seem counterintuitive, but in a highly nutritious environment, increased competition for nutrients can hinder individual growth, as more turtles compete for the same food resources. Also, consider what happens if the regrow rate is set to 100%.

  • Set the Habitat-A-nutrition-level to zero. Reflect on why not all animals in this habitat die. This scenario relates to the probability of dying established in the model's rules (see the HOW IT WORKS section).

CONCEPTUAL FRAMEWORK

This NetLogo model has been developed as a learning tool in the context of systems thinking, specifically applied to livestock production. The model explores the dynamics of survivor bias—a bias that can skew our understanding of performance outcomes when only the surviving individuals are considered—within the context of animal growth and mortality. In livestock farming, where key metrics such as growth rates are often calculated as averages, survivor bias can significantly distort the interpretation of data. By focusing only on the surviving animals, averages may suggest that a certain treatment or management strategy is highly effective, when in reality it may have caused increased mortality or other adverse effects in a significant portion of the population.

For example, if a feed supplement leads to higher average weight gain but also causes animals to die from complications, the average performance of the surviving animals will look improved. This can lead to misleading conclusions about the overall effectiveness of the treatment. The treatment may appear to boost productivity, but in reality, the producer incurs higher losses due to mortality, which can outweigh the gains in individual growth rates.

This distortion occurs because the animals that did not survive are not included in the final calculation of averages. As a result, the remaining, healthier animals skew the data, masking the true cost of the treatment. Without taking into account both mortality and the average health of the entire population, farmers and researchers might implement strategies that seem beneficial in the short term but are detrimental to long-term sustainability and profitability.

COPYRIGHT AND LICENSE

Copyright 2024 Christian Ramirez-Camba.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

To inquire about this model, please contact Christian Ramirez-Camba at ramir643@umn.edu.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  right-nutrition
  left-nutrition
  divider-x  ;; The x-coordinate of the dividing line between left and right sections
  deadwL
  deadwR

]

turtles-own [
  diet-level  ;; Turtles will have a property to represent their nutrition level
  steps-without-food  ;; Count how many steps the turtle takes without eating
  weight  ;; New variable to store the weight of each turtle
]

patches-own [
  has-food  ;; Each patch will have a boolean to indicate whether it has food
  originally-had-food  ;; Boolean: whether the patch originally had food during setup
  food-level         ;; A numeric value for the regrowth process (0 = no food, 1 = full food)

]

; This procedure sets up the world and the turtles

to setup
  clear-all

  ; Conditionally seed the random number generator
  if Repeatable-Run [ random-seed 12345 ]


  set deadwL[]
  set deadwR[]

  ; Set the dividing line in the center of the world
  set divider-x 0

  ; Initialize the nutrition levels using sliders
  set right-nutrition Habitat-B-nutrition-level
  set left-nutrition Habitat-A-nutrition-level

  ; Mark food patches in each habitat
  mark-food-patches-left
  mark-food-patches-right

  ; Create an identical list of weights for both groups
  let initial-weights n-values 50 [random-normal 100 15]  ;; Generate 50 weights

  ; Create turtles in the left section (xcor < divider-x) and set their diet to left-nutrition
  create-turtles 50 [
    setxy random-float (divider-x - min-pxcor) + min-pxcor random-ycor  ; Ensure turtle is on left
    set shape "sheep"
    set color red
    set diet-level left-nutrition

  ]

  ; Assign weights to left-side turtles
  let count-index 0
  ask turtles with [xcor < divider-x] [
    set weight item count-index initial-weights
    set count-index count-index + 1
  ]

  ; Create turtles in the right section (xcor >= divider-x) and set their diet to right-nutrition
  create-turtles 50 [
    setxy random-float (max-pxcor - divider-x) + divider-x random-ycor  ; Ensure turtle is on right
    set color blue
    set shape "sheep"
    set diet-level right-nutrition

  ]

  ; Reset index and assign identical weights to right-side turtles
  set count-index 0
  ask turtles with [xcor >= divider-x] [
    set weight item count-index initial-weights
    set count-index count-index + 1
  ]

  reset-ticks
end 


; This updates the turtle sizes and restricts their movement

to go

  if count turtles with [xcor < divider-x] <= 2 or count turtles with [xcor >= divider-x] <= 1 [
    stop  ;; End the simulation if condition is met
  ]

  if ticks >= 1000 [
    stop
  ]

  ask turtles [
    if xcor < divider-x [  ; Left side turtles

      move-left-section  ; Move turtles in the left section
      eat-food ; Turtles consume food on the patches they step on
      check-if-dead  ; Check if the turtle has walked more than 5 steps without food

    ]
    if xcor >= divider-x [  ; Right side turtles

      move-right-section  ; Move turtles in the right section
      eat-food ; Turtles consume food on the patches they step on
      check-if-dead  ; Check if the turtle has walked more than 5 steps without food

    ]
  ]


  ; Plot the average weights only if there are turtles present
  let avg-weight-left (ifelse-value count turtles with [xcor < divider-x] > 0 [mean [weight] of turtles with [xcor < divider-x]] [0])
  let avg-weight-right (ifelse-value count turtles with [xcor >= divider-x] > 0 [mean [weight] of turtles with [xcor >= divider-x]] [0])


  set-current-plot "Average Weights"
  set-current-plot-pen "Habitat A"
  plot avg-weight-left

  set-current-plot-pen "Habitat B"
  plot avg-weight-right


  ; Calculate the cumulative weight * number of turtles for each section
  let cumulative-left sum [weight] of turtles with [xcor < divider-x]
  let cumulative-right sum [weight] of turtles with [xcor >= divider-x]

  ; Update plot for cumulative weight
  if Population-Weight [
    set-current-plot "Total Population Weight"
    set-current-plot-pen "Habitat A"
    plot sum [weight] of turtles with [xcor < divider-x]

    set-current-plot-pen "Habitat B"
    plot sum [weight] of turtles with [xcor >= divider-x]
  ]


  if Dead-Animals [
    set-current-plot "Dead Animals"
    set-current-plot-pen "Habitat A"
    plot 50 - count turtles with [xcor < divider-x]

    set-current-plot-pen "Habitat B"
    plot 50 - count turtles with [xcor > divider-x]
  ]


  ; Handle food regrowth in patches that originally had food
  ask patches with [originally-had-food and not has-food] [
    regrow-food
  ]

  tick
end 

; Procedure to move turtles in the left section and restrict movement to that area

to move-left-section
  left random 360
  forward 1
  if xcor > divider-x [ set xcor divider-x - 0.1 ]  ; Prevent crossing to the right side
  if xcor < min-pxcor [ set xcor min-pxcor + 0.1 ]  ; Prevent crossing world boundary

  ;; Increment steps without food
  set steps-without-food steps-without-food + 1
end 

; Procedure to move turtles in the right section and restrict movement to that area

to move-right-section
  left random 360
  forward 1
  if xcor < divider-x [ set xcor divider-x + 0.1 ]  ; Prevent crossing to the left side
  if xcor > max-pxcor [ set xcor max-pxcor - 0.1 ]  ; Prevent crossing world boundary

  ;; Increment steps without food
  set steps-without-food steps-without-food + 1
end 

; Turtles consume food from the patches they step on

to eat-food

  if has-food-on-patch? [
    ;; Reset steps-without-food to 0 when food is found
    set steps-without-food 0

    ;; Increase the turtle's weight by 1 unit
    set weight weight + 0.01
  ]

  ask patch-here [
    if has-food [
      set has-food false  ; No more food on this patch
      set food-level 0    ; Food is fully consumed

      ; Change patch color based on its section
      if pxcor < divider-x [  ; If the patch is in the left section
        set pcolor brown - 2  ; Set patch color to brown - 2
      ]
      if pxcor >= divider-x [  ; If the patch is in the right section
        set pcolor brown       ; Set patch color to brown
      ]
    ]
  ]
end 

; Helper procedure to check if there's food on the patch

to-report has-food-on-patch?
  report [has-food] of patch-here
end 

to check-if-dead
  if steps-without-food > 10 [

    ; Compute growth quantiles separately for each habitat
    let all-growths-left [weight] of turtles with [xcor < divider-x]
    let all-growths-right [weight] of turtles with [xcor >= divider-x]

    ; Find the animal's growth rank in its habitat
    let my-quantile 0

    if xcor < divider-x [
      let sorted-growths sort all-growths-left
      let my-rank position weight sorted-growths
      set my-quantile my-rank / length sorted-growths  ;; Normalize rank to a 0-1 scale
    ]

    if xcor >= divider-x [
      let sorted-growths sort all-growths-right
      let my-rank position weight sorted-growths
      set my-quantile my-rank / length sorted-growths  ;; Normalize rank to a 0-1 scale
    ]

    ; Set death probability
    let death-probability 0.25 * (1 - my-quantile )

    ; Ensure probability stays between 0 and 1
    set death-probability max (list 0 (min (list 1 death-probability)))

    ; Determine if the turtle dies based on probability
    if random-float 1 < death-probability [
      if xcor < divider-x [
        set deadwL lput weight deadwL
      ]
      if xcor >= divider-x [
        set deadwR lput weight deadwR
      ]
      die  ;; The turtle dies
    ]

    ;; If the turtle survives, reset steps-without-food
    set steps-without-food 0
  ]
end 

to-report show-left-turtle-count
  ifelse Dead-Animals [
    report count turtles with [xcor < divider-x]
  ] [
    report ""
  ]
end 

to-report show-right-turtle-count
  ifelse Dead-Animals [
    report count turtles with [xcor > divider-x]
  ] [
    report ""
  ]
end 


; Regrow food on patches that originally had food

to regrow-food
  ;; Increment the food-level based on the regrow-rate(10%)
  set food-level food-level + (1 / 10)

  ;; Once the food has fully regrown (reaches 1), set the patch as having food
  if food-level >= 1 [
    set food-level 1
    set has-food true
    set pcolor green  ;; Patch turns green when food regrows
  ]
end 


; Procedure to mark food patches in the left section based on the Habitat-A-nutrition-level slider

to mark-food-patches-left
  let total-patches count patches with [pxcor < divider-x]
  let food-patches count patches with [pxcor < divider-x] * Habitat-A-nutrition-level / 100

  ask patches with [pxcor < divider-x] [
    set has-food false  ;; Clear previous food
    set pcolor brown - 2  ;; Reset patch color to default (brown)
    set originally-had-food false
    set food-level 0     ;; No food initially
    set pcolor brown - 2     ;; Reset patch color to default (brown)
  ]

  ; Randomly assign food to a percentage of patches in the left section
  ask n-of food-patches patches with [pxcor < divider-x] [
    set has-food true
    set originally-had-food true  ;; Mark these patches as originally having food
    set food-level 1  ;; Full food level initially
    set pcolor green  ;; Patches with food appear green
  ]
end 

; Procedure to mark food patches in the right section based on the Habitat-B-nutrition-level slider

to mark-food-patches-right
  let total-patches count patches with [pxcor >= divider-x]
  let food-patches count patches with [pxcor >= divider-x] * Habitat-B-nutrition-level / 100

  ask patches with [pxcor >= divider-x] [
    set has-food false  ;; Clear previous food
    set originally-had-food false
    set food-level 0     ;; No food initially
    set pcolor brown  ;; Reset patch color to default (brown)
  ]

  ; Randomly assign food to a percentage of patches in the right section
  ask n-of food-patches patches with [pxcor >= divider-x] [
    set has-food true
    set originally-had-food true  ;; Mark these patches as originally having food
    set food-level 1  ;; Full food level initially
    set pcolor green  ;; Patches with food appear green
  ]
end 

There is only one version of this model, created 1 day ago by Christian Ramirez.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.