Fabio Cosio Chiara Marsupino Giorgia Monaco

Simulation models for economics

Project work on

"Students' behaviour."


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.

Here you can find an introduction to the Students' behaviour application.

powered by NetLogo

view/download model file: students'_behaviour.nlogo


The aim of our model is to simulate the students behavior when they have to choice the faculty to enroll. We assume that their choice is affected by 3 main variables: Employment rate, distance and preference. That is, before deciding they, look at these 3 variables.
Moreover there is a properties of the students (their income) which works as a corrector. it means that it changes the probability that a student chooses with respect to one variable rather than another one


The three buttons on the interface which allow us to run the model are: Setup, go[forever], go.
Clicking on setup we have to choose among 3 different populations of students which have 3 different distributions: heterogeneous, homogeneous and with a new curriculum.
After the setup the user has to click on the button “go” which lets to start the simulation: If he click on the lefter “go” - which is a forever button - it will continually run its commands until he shut it off (by clicking on it again). If he click on the other button “go” it will run its commands tick by tick (you have to click on it every time that you want to increase by one tick)


In order to use the model we have to click on setup, choose a population and then click on one of the two “go”.
On the right you can see the graphical user interface which shows the population for each degree. Each year students move to the following one so that after 5 year some of them graduate and find a job while the others become unemployed.
On the left we have the input boxes concerning the workplaces available for each degree, the sliders which measures the difficulty of each degree and other sliders which set the probability that a student makes his choices with respect to one variable rather than another one.
Essentially, our model gives the result that: the higher the workplaces and the more difficult the faculty then the higher the employment rate.
The intuition behind is that the more difficult a degree the lower is the number of students enrolled. As a consequence, since the workplaces stay fix, the employment rate increases.


Look at the behavior of the employment rate and the enrollment trend per degree. It is worth to notice that these trends change according to the population that we use in fact, regardless the homogeneous population, medicine and engineering show the highest employment rate, due to the their difficulty and to the high number of workplaces.
Instead, if we use the heterogeneous population we witness a shock in the short run. Humanities has the lower number of enrolled students, that’s why the employment rate increases dramatically. If we run the last experiment – using the population with the new curriculum – we notice that the employment rate of Medicine is equal to 0 at the first few years, but it skyrockets when the first enrolled will graduate after five years. Likewise the enrollment trend rises dramatically at the beginning, overtaking the enrollments trend of the other degrees
Nevertheless the system after the initial shocks tend to come back to the usual trends


The model that we have constructed makes use of files. It can be very useful if we want to make a simulation taking some real data from the real world or simply if we want to make different experiments.

Moreover we have conceived the model in such a way that the user can change the parameters. F.i. if he increases the difficulty of a specific degree, then a larger number of students will abandon earlier its studies in that degree. As a consequence the employment rate will raise for that specific degree.
Furthermore he can move the 3 sliders concerning the probability. We have assumed that the preference rate has the highest probability, alternatively he could assume different probabilities.
Lastly we can change the values in the input boxes regarding the workplaces. obviously the more the workplaces the higher the employment rate(keeping fixed the other sliders)


in order to improve the model we can include other variables which could affect the selection criterion. For instance the vote of maturity could affect the choice of students: the higher it is the more students will be pushed towards more difficult or more remunerative degrees.
Moreover the income effect could be more precise (adding more categories).
Finally the degrees could be much more in order to simulate better the real world.


breed [Students Student]
Students-own [year fac  intell income pref dist ]
globals [EmpRateEng EmpRateHum EmpRateEco EmpRateMed gradEng gradEco GradHum gradMEd EmpRate prob dead1 dead2 dead3 dead4]

to setup
ask patches [set pcolor white]

ask patch 15 -25  [set plabel "Medicine"   set pcolor orange  set plabel-color black]
ask patch 5 -25   [set plabel "Economics"  set pcolor violet  set plabel-color black]
ask patch -5 -25  [set plabel "Humanities" set pcolor blue    set plabel-color black]
ask patch -15 -25 [set plabel "Engineering"set pcolor yellow  set plabel-color black]

ask patch -20 -23 [set plabel "1" set plabel-color black]
ask patch -20 -15 [set plabel "2" set plabel-color black]
ask patch -20 -7  [set plabel "3" set plabel-color black]
ask patch -20 1   [set plabel "4" set plabel-color black]
ask patch -20 9   [set plabel "5" set plabel-color black]

file-open inputFile
while [not file-at-end?]

[create-Students 1
  [ set heading 0 
    set fac file-read
    if fac = 4 [ set color orange ]
    if fac = 3 [ set color violet ]
    if fac = 2 [ set color blue ]
    if fac = 1 [ set color yellow ] 
    set intell random-float 1           ; proprietà che ci serve per calcolare il numero di studenti che lasciano l'università
    set year file-read
    setxy -12 + (10 * (fac - 1)) - random-float(6) -23 +(8 * (year - 1)) + random-float(4)  ;funzione che ci permette di posizionare le coordinate x degli studenti proporzionalmente alla facoltà                                                                                             ;e le coordinate y proporzionali all'anno di frequenza    
   type "Eng: "  type count Students with [year = 5 and fac = 1 ] 
   type " Hum: " type count Students with [year = 5 and fac = 2 ] 
   type " Eco: " type count Students with [year = 5 and fac = 3 ] 
   type " Med: " print count Students with [year = 5 and fac = 4 ]
   set EmpRateEng 0
   set EmpRateHum 0
   set EmpRateEco 0
   set EmpRateMed 0

to go
  set dead1 0
  set dead2 0
  set dead3 0
  set dead4 0

to growth
    ask Students 
     [set year year + 1                             
      fd 8
      if year < 6 [
        if fac = 1 and DifficultyEng > intell [set dead1 dead1 + 1 die]
        if fac = 2 and DifficultyHum > intell [set dead2 dead2 + 1 die]  ; Per simulare l'abbandono degli studi: condronto tra il parametro stabilito da interfaccia e valore della proprietà
        if fac = 3 and DifficultyEco > intell [set dead3 dead3 + 1 die]  ; "intell" associata a ciascun studente. Il parametro "Failed(fac)Param" può essere intepretato come "difficoltà
        if fac = 4 and DifficultyMed > intell [set dead4 dead4 + 1 die]  ; delle facoltà"
;        type " DeadEng: " type dead1 type " DeadHum: " type dead2 type " DeadEco: " type dead3 type " DeadMed: " print dead4     

 to graduate
    set gradEng count Students with [fac = 1 and year = 6] 
    set gradHum count Students with [fac = 2 and year = 6]
    set gradEco count Students with [fac = 3 and year = 6]
    set gradMed count Students with [fac = 4 and year = 6]
 to defEmpRate
    if gradEng > 0 [set EmpRateEng  0.5 * EmpRateEng + 0.5 * EmployedEng / gradEng  ] if EmpRateEng > 1 [set EmprateEng  1]   ;Media tra lo scorso e l'attuale EmpRate
    if gradHum > 0 [set EmpRateHum  0.5 * EmprateHum + 0.5 * EmployedHum / gradHum  ] if EmpRateHum > 1 [set EmprateHum  1]
    if gradEco > 0 [set EmpRateEco  0.5 * EmpRateEco + 0.5 * EmployedEco / gradEco  ] if EmpRateEco > 1 [set EmprateEco  1]
    if gradMed > 0 [set EmpRateMed  0.5 * EmpRateMed + 0.5 * EmployedMed / gradMed  ] if EmpRateMed > 1 [set EmprateMed  1]
    set EmpRate []
     set EmpRate lput EmpRateEng EmpRate
     set EmpRate lput EmpRateHum EmpRate
     Set EmpRate lput EmpRateEco EmpRate
     set EmpRate lput EmpRateMed Emprate
    ask Students with [year > 5] 
to newStudents
  create-Students 120
   [ set year 1
     set heading 0
     set intell random-float 1    ;proprietà degli studenti che assume valori in un intervallo continuo [0 1]. Tale valore è confrontanto con il tasso di abbandono impostato da slider
     set pref 1 + random 4
     set dist 1 + random 4
     set income 1 + random 3
     let tpref prefprob        ; variabili temporanee associate alle preferenze. Esse possono variare al variare dell'income influenzando il criterio di scelta
     let tdist distprob
     let temprate  emprateprob
     let choice 1 + random 4
     if incomeCorrectionMechanism = true
     [if income = 1 [ set tdist tdist * 2]      ;influenza dell'income
     if income = 2 [ set temprate temprate * 2 ]
     if income = 3 [ set temprate temprate * 2 
                     set tpref tpref * 2 

     if tdist > temprate and tdist > tpref [ set choice dist ]
     if tpref > temprate and tpref > tdist [ set choice pref ]
     if temprate  > tpref and temprate > tdist [
                                         let maxEmpRate 0               ;algoritmo per la ricerca del massimo. In questo caso ricerco il valore massimo dell'EmpRate. Cme Funziona: 
                                         let facOfMax 1                 ;    prendi l'elemento i (actualFac)
                                         let actualFac 1                ;^       - l'elemento è maggiore del maggiore fino a questo momento?                
                                         foreach emprate [              ;|                     - si: allora salva questo elemento come maggiore e salvati a           
                                               if ? > maxEmpRate [      ;|                       quale posizione (i) corrisponde
                                               set facOfMax actualFac   ;|                     - no: non fare niente
                                               set maxEmpRate ?         ;| <-    - incrementa i e prosegui con il prossimo elemento
                                           set actualFac actualFac + 1 
                                         set choice FacOfMax

     set fac choice 
     setxy -12 + (10 * (fac - 1)) - random-float(6) -23 +(8 * (year - 1)) + random-float(4)
     if fac = 1 [set color yellow]
     if fac = 2 [set color blue]
     if fac = 3 [set color violet]
     if fac = 4 [set color orange]