Quantitative Genetics Experiments

Quantitative Genetics Experiments preview image

1 collaborator

Default-person Andrew McDevitt (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0 • Viewed 388 times • Downloaded 55 times • Run 0 times
Download the 'Quantitative Genetics Experiments' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

;extensions [table]
breed [rabbit rabbits]
breed [parents parent]
breed [trees tree]
breed [hawks hawk]
breed [offsprings offspring]
breed [wolves wolf]
breed [rabbit-holes rabbit-hole]
breed [carrots carrot]
breed [lakes lake]

globals[
  t1-mean
  t1-var
  t2-mean
  t2-var
  t3-mean
  t3-var
  t4-mean
  t4-var
]

parents-own[
  trait1-p
  trait2-p
  trait3-p
  trait4-p
  t1-parent
  t1-offspring
  t2-parent
  t2-offspring
  t3-parent
  t3-offspring
  t4-parent
  t4-offspring
]
offsprings-own [
  trait1-o
  trait2-o
  trait3-o
  trait4-o
]

to setup-population
  ca
  reset-ticks
  ask patches [; create unknown background
    set pcolor 4 - (random 3)
  ]
  create-parents 1000 [
    set trait1-p median (list 0 (random-normal 55 5) 100)
    set t1-parent median (list 30 (random-normal 55 5) 70)
    set t1-offspring (t1-parent * median (list 0 (random-normal .5 .02) 1))
    set trait2-p median (list 0 (random-normal 55 6) 100)
    set t2-parent median (list 30 (random-normal 55 5) 70)
    set t2-offspring (t2-parent * median (list 0 (random-normal .3 .02) 1))
    set trait3-p median (list 0 (random-normal 25 7) 100)
    set t3-parent median (list 0 (random-normal 25 7) 100)
    set t3-offspring (t3-parent * median (list 0 (random-normal .90 .02) 1))
    set trait4-p median (list 0 (random-normal 165 20) 260)
    set t4-parent median (list 0 (random-normal 165 20) 260)
    set t4-offspring (t4-parent * median (list 0 (random-normal .10 .02) 1))
    set shape "rabbit"
    setxy random-xcor random-ycor
    set color white

  ]
  set t1-mean "NA"
  set t1-var "NA"
  set t2-mean "NA"
  set t2-var "NA"
  set t3-mean "NA"
  set t3-var "NA"
  set t4-mean "NA"
  set t4-var "NA"
  tick
end 

to setup-habitat
  ask trees [die]
  ask hawks [die]
  ask wolves [die]
  ask rabbit-holes [die]
  ask carrots [die]
  ask parents[
    set hidden? TRUE
  ]
  ask offsprings[
    set hidden? TRUE
  ]

  ask patches [; create grass
    set pcolor 61 + grass-color + (random-float 0.4167 * grass-patchiness)
  ]
  ask n-of water patches [set pcolor sky]
  create-rabbit-holes n-rabbit-holes[
    set shape "circle"
    set size .3
    setxy random-xcor random-ycor
    set color black
  ]
  create-wolves n-wolves[
    set shape "wolf"
    set size 2
    setxy random-xcor random-ycor
    set color 2
  ]

  create-trees n-trees[
    set shape "tree pine"
    set color 51
    setxy random-xcor random-ycor
    set size 3
  ]
  create-carrots n-carrots[
    set shape "carrot"
    setxy random-xcor random-ycor
    set size 1.5
  ]
  create-hawks n-hawks[
    set shape "hawk"
    set size 1.5
    setxy random-xcor random-ycor
    set color brown
  ]
end 

to unhide-pop
  clear-output
  reset-ticks
  ask trees [die]
  ask hawks [die]
  ask wolves [die]
  ask offsprings [die]
  ask rabbit-holes [die]
  ask carrots [die]
  ask patches [; create unknown background
    set pcolor 4 - (random 3)
  ]
  ask parents [
    set hidden? FALSE
  ]
  tick
end 

to setup-offspring

  setup-habitat
  reset-ticks
  tick
  ask offsprings [die]
  ask parents[
    set hidden? TRUE
  ]
  ask offsprings[
    set hidden? FALSE
  ]

  create-offsprings 1000 [

   ;if (grass-color = 2) [set trait1-o median (list 0 (random-normal (t1-mean) (sqrt(12.5 + (12.5 * ((0.5 * (grass-patchiness / 6)) +(0.5 * (n-carrots / 50))))))) 100)]
    set trait1-o median (list 0 (random-normal (59 - grass-color * 2) (sqrt(12.5 + (12.5 * ((0.5 * (grass-patchiness / 6)) +(0.5 * (n-carrots / 50))))))) 100)
    if (n-wolves = 0) and (n-hawks = 0) [set trait2-o median (list 0 (random-normal 55 6) 100)]
    if (n-wolves = 0) and (n-hawks != 0) [set trait2-o median (list 20 (random-normal (55 + (15 * (n-hawks / 20))) 5.25) 75)]
    if (n-wolves != 0) and (n-hawks = 0) [set trait2-o median (list 35 (random-normal (55 - (30 * (n-wolves / 20))) 5.25) 85)]
    ;if (n-wolves != 0) and (n-hawks != 0) [set trait2-o ifelse-value (random-float 1 < 0.5) [median (list 20 (random-normal (55 - (35 * (n-wolves / 20))) 5) 100)] [ median (list 0 (random-normal (55 + (10 * (n-hawks / 20))) 5) 85)]]
    if (n-wolves != 0) and (n-hawks != 0) [set trait2-o median (list (20 + (0.5 * n-hawks)) (random-normal (55 - ((1.5 * n-wolves)- (0.75 * n-hawks))) (6 - (3 * (((2 * n-wolves) + n-hawks) / 40)))) (85 - (1 * n-wolves)))]
    if (n-wolves = 10) and (n-hawks = 20) [set trait2-o median (list (20 + (0.5 * n-hawks)) (random-normal 55 (6 * ((n-wolves / 20) / (n-hawks / 20)))) (85 - (1 * n-wolves)))]
    ;set trait3-o median (list 0 (random-normal (20 + (15 * (n-rabbit-holes / 100))) 7) 100)
    set trait3-o ifelse-value (random-float 1 < 0.5) [median (list 0 (random-normal (25 - (10 * (2 * n-rabbit-holes / 100))) 5) 100)] [ median (list 0 (random-normal (25 + (10 * (2 * n-rabbit-holes / 100))) 5) 100)]
    set trait4-o median (list 0 (random-normal (100 + water) 20) 260)
    set shape "rabbit"
    setxy random-xcor random-ycor
    set color white
  ]
  ifelse (grass-color = 2) [set t1-mean mean [trait1-p] of parents] [set t1-mean mean [trait1-o] of offsprings]
  ifelse (grass-patchiness = 6) and (n-carrots = 50) [set t1-var variance [trait1-p] of parents] [set t1-var variance [trait1-o] of offsprings]
  ifelse (n-wolves = 0) and (n-hawks = 0) [set t2-mean mean [trait2-p] of parents set t2-var variance [trait2-p] of parents] [set t2-mean mean [trait2-o] of offsprings set t2-var variance [trait2-o] of offsprings]
  ifelse (n-rabbit-holes = 25) [set t3-mean mean [trait3-p] of parents set t3-var variance [trait3-p] of parents] [set t3-mean mean [trait3-o] of offsprings set t3-var variance [trait3-o] of offsprings]
  ifelse (water = 65) [set t4-mean mean [trait4-p] of parents set t4-var variance [trait4-p] of parents] [set t4-mean mean [trait4-o] of offsprings set t4-var variance [trait4-o] of offsprings]
tick
end 

There are 7 versions of this model.

Uploaded by When Description Download
Andrew McDevitt over 3 years ago Removed some confusing language - web compatible version Download this version
Andrew McDevitt over 3 years ago Removed some confusing language Download this version
Andrew McDevitt over 6 years ago slider default Download this version
Andrew McDevitt over 6 years ago graph updates Download this version
Andrew McDevitt over 6 years ago graph updates Download this version
Andrew McDevitt over 6 years ago table bug Download this version
Andrew McDevitt over 6 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Quantitative Genetics Experiments.png preview Preview for 'Quantitative Genetics Experiments' over 6 years ago, by Andrew McDevitt Download

This model does not have any ancestors.

This model does not have any descendants.