This page was automatically generated by NetLogo 5.0.3.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

Clicking the “setup” button will initialize the model and clicking the “go” button will run it. Here, stress is depicted using colored bars of increasing intensity to illustrate the diathesis-stress relationship. The plot shows depressive symptom levels, the threshold for diagnosis and that for remission. The simulation occurs over 730 days, as represented on the horizontal axis. If the applet runs too fast or too slow, it can be slowed down or speeded up using the slider at the top of the interface. To adjust the model parameters (diathesis and adaptation constant) these parameters can be changed using the “sliders” on the interface. When new settings are applied, the “setup” button should be clicked to initialize the model with the new settings before clicking “go.”

powered by NetLogo

view/download model file: model_1.nlogo


This model is intended to provide a simplified demonstration of some aspects of the diathesis-stress model.


An episode of depression is identified by determining whether symptoms exceed a threshold-based definition, as in DSM-IV and ICD-10 diagnostic definitions. An episode ends when the symptoms have dropped to a lower level than the threshold, e.g. when symptoms are only half as severe as they were initially. Both the threshold and the stringency of the remission definition are present on the graphical interface as sliders.

In a diathesis-stress conceptualization of depression, symptom levels result from an interaction between diathesis (vulnerability) and exposure to a stressor. A value for diathesis can be set using a slider. A component of the depressive diathesis is slower adaptation to stress. In this model, the level of symptoms on a given day is depicted as a product of diathesis and stress severity minus an element of adaptation, which is inversely proportional to the diathesis. The proportionality constant can also be set on using a slider. A 14 day moving average (thought to be consistent with the 2-week duration requirements of DSM and ICD) is depicted on the plot. The agent starts at the left side of the screen and moves to the right. The red bars represent exposure to stressors, at increasing severity as depicted by their increasing brightness.


The effect of increasing the diathesis can be explored by changing the value of this variable. The output plot shows the level of symptoms, upon which the user can depict various values for the diagnostic threshold and the stringency of a remission diagnosis.


The interaction between diathesis and stress results in symptom levels that exceed the diagnostic threshold when the diathesis is high.


globals []
turtles-own [age stressactivation stressadaptation stressburden tminus14 timinus13 tminus12 tminus11 tminus10 tminus9 tminus8 tminus7 tminus6 tminus5 tminus4 tminus3 tminus2 tminus1 runningaverage]
patches-own [stress]

To setup
  ;; the following commands set up a series of stressors of increasing intensity, through which the turtle will move.
  ask patches [if pxcor <= 25 [set stress 0]]
  ask patches [if pxcor > 50 and pxcor <= 55 [set stress 1]]
  ask patches [if pxcor > 55 and pxcor <= 100 [set stress 0]]
  ask patches [if pxcor > 100 and pxcor <= 105 [set stress 2]]
  ask patches [if pxcor > 105 and pxcor <= 150 [set stress 0]]
  ask patches [if pxcor > 150 and pxcor <= 155 [set stress 3]]
  ask patches [if pxcor > 155 and pxcor <= 200 [set stress 0]]
  ask patches [if pxcor > 200 and pxcor <= 205 [set stress 4]]
  ask patches [if pxcor > 205 and pxcor <= 250 [set stress 0]]
  ask patches [if pxcor > 250 and pxcor <= 255 [set stress 5]]
  ask patches [if pxcor > 255 and pxcor <= 300 [set stress 0]]
  ask patches [if pxcor > 300 and pxcor <= 305 [set stress 6]]
  ask patches [if pxcor > 305 and pxcor <= 350 [set stress 0]]
  ask patches [if pxcor > 350 and pxcor <= 355 [set stress 7]]
  ask patches [if pxcor > 355 and pxcor <= 400 [set stress 0]]
  ask patches [if pxcor > 400 and pxcor <= 405 [set stress 8]]
  ask patches [if pxcor > 405 and pxcor <= 450 [set stress 0]]
  ask patches [if pxcor > 450 and pxcor <= 455 [set stress 9]]
  ask patches [if pxcor > 455 and pxcor <= 500 [set stress 0]]
  ask patches [if pxcor > 500 and pxcor <= 505 [set stress 10]]
  ask patches [if pxcor > 505 and pxcor <= 550 [set stress 0]]
  ask patches [if pxcor > 550 and pxcor <= 555 [set stress 11]]
  ask patches [if pxcor > 555 and pxcor <= 600 [set stress 0]]
  ask patches [if pxcor > 600 and pxcor <= 605 [set stress 12]]
  ask patches [if pxcor > 605 and pxcor <= 650 [set stress 0]]
  ask patches [if pxcor > 650 and pxcor <= 655 [set stress 13]]
  ask patches [if pxcor > 655 and pxcor <= 730 [set stress 0]]
  ;; this command makes the color of the patches with elevated stress proportionally shaded to the stress level.
  ask patches [set pcolor scale-color red stress 0 13]
  crt 1 [setxy 0 50 set color yellow set heading 90 set age 0 set size 8 set age 0]
  ;; the following commands initialize the stressactivation variable at zero, as stress is zero at pxcor = 0, and prepare a file to collect the output.
  ask turtles [set stressburden diathesis * stress ]

To go
  ask turtles [fd 1 display]
  ask turtles [set age age + 1]
  ;; the following commands are the ones designed to reflect diathesis-stress and adaptation (see "information")
  ask turtles [set stressactivation diathesis * stress]
  ask turtles [set stressadaptation stressburden * (1 / ( 1 + diathesis * durationconstant))]
  ask turtles [set stressburden stressburden + stressactivation - stressadaptation]
  ;; the following commands calculate a running average of depressive symptoms.
  ask turtles [set tminus14 timinus13 set timinus13 tminus12 set tminus12 tminus11 set tminus11 tminus10 set tminus10 tminus9 set tminus9 tminus8 set tminus8 tminus7]
  ask turtles [set tminus7 tminus6 set tminus6 tminus5 set tminus5 tminus4 set tminus4 tminus3 set tminus3 tminus2 set tminus2 tminus1 set tminus1 stressburden]
  ask turtles [set runningaverage ((tminus14 + timinus13 + tminus12 + tminus11 + tminus10 + tminus9 + tminus8 + tminus7 + tminus6 + tminus5 + tminus4 + tminus3 + tminus2 + tminus1) / 14)]
  ask turtles [if age > 730 [die]]
  if not any? turtles [ stop ]
  ask turtles [do-plotting]

To do-plotting
  set-current-plot-pen "diagnostic threshold"
  plotxy ticks threshold
  set-current-plot-pen "symptom level"
  plotxy ticks runningaverage 
  set-current-plot-pen "remission threshold"
  plotxy ticks remissionstringency * threshold