22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina...

35
22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna [email protected] Dipartimento di scienze economiche e finanziarie “G.Prato” Università di Torino - Italia Master in Economia e politica sanitaria 2007-2008 Simulazione per la sanità – 4/5 web.econ.unito.it/terna web.econ.unito.it/terna/materiale/master _ec_pol_san/

Transcript of 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina...

Page 1: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

1

cope

rtin

a

Pietro Terna [email protected]

 Dipartimento di scienze economiche e finanziarie “G.Prato”

Università di Torino - Italia

Master in Economia e politica sanitaria 2007-2008 Simulazione per la sanità – 4/5

web.econ.unito.it/terna web.econ.unito.it/terna/materiale/master_ec_pol_san/

Page 2: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

2

Page 3: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

3

§ 3.3

Page 4: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

4

_Net

Log

o

_______________________________________

Impariamo ad usare NetLogo (segue):

i camaleonti

_______________________________________

Page 5: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

5

Preservare l’identità!

• Apprendimento con rinforzo e riconoscimento di situazioni con razionalità limitata

• Il cervello degli agenti in 9 NN

Page 6: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

6

Let play

Page 7: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 7Master in economia e politica sanitaria - Simulazione per la sanità

Page 8: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

8

§ 4.1

Page 9: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

9

_Net

Log

o

_______________________________________

Un articolo divulgativo

_______________________________________

Page 10: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

10

Page 11: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

11

§ 4.2

Page 12: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

12

_Str

umen

ti, s

egui

to

_______________________________________

Un sistema di simulazione con

elevate capacità di integrazione e

visualizzazione:

AnyLogic

_______________________________________

Page 13: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

13

• Simulazione strategica, system dynamics, http://sysdyn.clexchange.org/ (MIT System Dynamics in Education Project)

• Simulazione con agenti, la “nostra”, D. Parisi (2001), Simulazioni - La realtà rifatta nel computer. Mulino, Bologna; L. Tesfatsion (2001), Agent-Based Computational Economics: Growing Economies from the Bottom Up. ISU Economics Working Paper, n. 1, http://www.econ.iastate.edu/tesfatsi/acealife.pdf; in generale, http://www.econ.iastate.edu/tesfatsi/ace.htm

• Simulazione di processo o a eventi discreti

• Un bel confronto a http://www.xjtek.com/files/papers/fromsystemdynamics2004.pdf

ripreso da M

etodologie di simulazione

Page 14: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

14

AnyLogic

http://www.xjtek.com/

Page 15: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

15

Page 16: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

16

Page 17: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

17

Page 18: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

18

§ 4.3

Page 19: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

19

_Str

umen

ti, s

egui

to

_______________________________________

Un modello di riferimento:cocktail party

Model library, prove pt/party pt

_______________________________________

Page 20: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

20

cock

tail

par

ty 1

WHAT IS IT?

-----------

This program models a cocktail party. The party is made up of groups of both men and women. The partygoers have a TOLERANCE that defines their comfort level with a group that has members of the opposite sex. If they are in a group that has a higher percentage of people of the opposite sex than their TOLERANCE allows, then they are considered "uncomfortable", and they leave that group to find another group. This action continues until everyone at the party is "comfortable" within their group.

This model is based on the work of the pioneering economist Thomas Schelling. It is also described in: Resnick, M. & Wilensky, U. (1998). Diving into Complexity: Developing Probabilistic Decentralized Thinking through Role-Playing Activities. Journal of Learning Sciences, Vol. 7, No. 2. http://ccl.northwestern.edu/cm/papers/starpeople/

Page 21: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

21

cock

tail

par

ty 2

HOW TO USE IT

-------------

To set the number of people at the party, use the NUMBER slider.

To set the number of initial groups, use the NUM-GROUPS slider.

To set the tolerance of the people for the opposite sex, use the TOLERANCE slider. If the TOLERANCE slider is set to 75, then each person will tolerate being in a group with less than or equal to 75% people of the opposite sex. If there are more than this, the person is uncomfortable, and he/she leaves the group and tries out an adjacent group.

The SETUP button sets up all the people into random groups. The GO button sets the party in motion. You can use the STEP-ONCE button to make all uncomfortable partygoers move once. The MOVES monitor shows the number of times people move from their groups. The NUMBER-HAPPY monitor shows how many people are content and this value is dynamically graphed in the "happy partygoers" plot. The counts are shown in gray for "single-sex" groups, white for mixed groups. The simulation ends when everyone is happy. The SINGLE-SEX-GROUPS monitor shows the number of single-sex groups and this value is dynamically plotted in the "single sex groups" plot.

Page 22: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

22

cock

tail

par

ty 3

RUNNING the MODEL

-----------------

THINGS TO NOTICE

----------------

At the end of the simulation (when everyone is happy), notice the number of single-sex groups. Is there an increase from their initial compositions?

Is there a critical tolerance at which each group ends up being a single-sex group?

Notice the difference in time it takes for all groups to be comfortable depending upon the tolerance.

THINGS TO TRY

-------------

See how many mixed groups (not a single-sex group) you can get.

Use the STEP-ONCE button, and experiment with different tolerances. Watch how one unhappy person can disrupt the stability of other groups.

Is it possible to have an initial grouping such that the party is never completely content? (i.e. the model never terminates)

Observe real parties. Is this model descriptive of real social settings? What tolerances would model the people in the real party?

Page 23: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

23

Net

Log

o es

. 4

Vediamo ora il listato del programma

party_pt.nlogo

Party

Page 24: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

24

§ 4.4

Page 25: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

25

_Str

umen

ti, s

egui

to

_______________________________________

Un modello di riferimento:cocktail party

Model library, prove pt/party_pt

party_pt.nlogo, in linea a (per NetLogo 3)

web.econ.unito.it/terna/materiale/master_ec_pol_san/

_______________________________________

Page 26: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

26

;The 'turtles-own' keyword, like the globals, breed, <BREED>-own, and patches-own keywords, ;can only be used at the beginning of a program, before any function definitions. ;It defines the variables belonging to each turtle

turtles-own [man? woman? happy?]patches-own [men women people]globals [boring-groups moves number-happy group-sites]

to setup ca ; 'with' takes two inputs: on the left, an agentset (usually "turtles" or "patches"). ; On the right, a boolean reporter. set group-sites patches with [group-site?] set-default-shape turtles "person"

; 'cct' create-custom-turtles cct number [ ;;blue represents male, pink represents female. No stereotypes are meant ;;to be promoted. Simply change the colors right here if you'd like.

Page 27: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

27

;ifelse reporter [ commands1 ] [ commands2 ]

ifelse (random 2 = 0) [set man? true set woman? false set color blue] [set man? false set woman? true set color pink] ifelse (random 2 = 0) [set heading 90] [set heading 270] ;; randomly face right or left set ycor 0 set xcor random world-width ] ; These reporters give the total width and height of the NetLogo world. ; Screen-size is the same as ((2 * screen-edge) + 1)

ask turtles [move-into-groups] setup-patches setup-plots set moves 0 update-labels spread-people update-plotsend

Page 28: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

28

to setup-patches ask patches [ set men 0 set women 0 set people 0] ask turtles [ if man? [set men (men + 1)] if woman? [set women (women + 1)]] ask patches [ set people (men + women)] update-happiness update-boring-groupsend

to go if (number-happy = number) [ stop ;; stop the simulation if everyone is happy ] group-people ;; put all people on the x-axis update-happiness move-if-unhappy update-boring-groups update-labels spread-people ;; move the people into vertical columns set moves (moves + 1) update-plots if limit-speed? [ wait 0.75 ] ;; keep the spread groups on the screen for a bitend

Page 29: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

29

to update-labels ask group-sites [ set plabel count turtles-here ] ; plabel is a pattch label ; turtles-here reports an agentset containing all ; the turtles on the caller's patch (including the caller ; itself if it's a turtle). ; count agentset reports the number of agents in the given agentset

end

to update-happiness ask patches [ set people (men + women)] ask turtles [ ;;; you are happy if the proportion of people of the opposite sex does not exceed your tolerance if man? [ifelse (women / people) > (tolerance / 100) [set happy? false] [set happy? true]] if woman? [ifelse (men / people) > (tolerance / 100) [set happy? false] [set happy? true]] ;; if (happy? = true) [set num-happy (num-happy + 1)] ] set number-happy count turtles with [happy?] ;; update number-happy variableend

Page 30: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

30

to move-if-unhappy ask turtles [ if (not happy?) [ifelse man? [set men men - 1] ;;decrease the count in your old group [set women women - 1] ifelse (random 2 = 0) [set heading 90] [set heading 270] ;; randomly face right or left fd 1 ;; move out of your group move-into-groups ifelse man? [set men men + 1] [set women women + 1]]] ;;increase the count in your new in groupend

to move-into-groups ;;turtle procedure ; move forward until you hit the closest group if not group-site? [ fd 1 if limit-speed? [ wait 0.1 ] ;; slow it down so user can see it happening move-into-groups]end

Page 31: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

31

to-report group-site? ;; turtle or patch procedure ;; if your pycor is 0 and your pxcor is where a group should be located, ;; then you're a group site (patch) or on a group site (turtle) locals [group-interval] ;; first figure out how many patches apart the groups will be set group-interval floor (world-width / num-groups) report ;; first check pycor (pycor = 0) and ;; then check if the distance between groups divides evenly into ;; our distance from the right hand edge of the screen (((max-pxcor - pxcor) mod group-interval) = 0) and ;; finally, make sure we don't wind up with more groups than ;; the user asked for (floor ((max-pxcor - pxcor) / group-interval) < num-groups)end

to update-boring-groups ask group-sites [ set plabel-color white if people > 0 [if ((men = 0) or (women = 0)) [set plabel-color gray]]] set boring-groups (count group-sites with [plabel-color = gray])end

Page 32: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

32

to setup-plots set-current-plot "Happy Partygoers" set-plot-y-range 0 numberend

to update-plots set-current-plot "Happy Partygoers" set-current-plot-pen "Happy" plot (count turtles with [happy?]) set-current-plot "Single Sex Groups" plot boring-groupsend

;; spread people out vertically to spread-people ask turtles [ifelse man? [set heading 0 fd 2] [set heading 180 fd 2] jump count other-turtles-here] ;; this trick works because of the serial ordering of turtle execution ; 'jump': turtles move forward by number units all at once, without the ; amount of time passing depending on the distance.end ;; pile people up on the x-axis to group-people ask turtles [set ycor 0]end

Page 33: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

33

§ 1.8

Page 34: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

34

_Un

prob

lem

a “n

ostr

o”

_______________________________________

Un problema “nostro”

_______________________________________

Page 35: 22 maggio 2008Master in economia e politica sanitaria - Simulazione per la sanità 1 copertina Pietro Terna pietro.terna@unito.it Dipartimento di scienze.

22 maggio 2008 Master in economia e politica sanitaria - Simulazione per la sanità

35

prob

lem

a da

trat

tare

Il problema della mobilità dei pazienti oncologici

Persone che si spostano per ragioni sanitarie

• indizio di insoddisfazione?

• correlazione con ragioni di studio e lavoro

• esigenze di altri familiari

• indicazione del medico

• informazioni tra pazienti

• differenze tra strutture (es. mancanza della radioterapia)

• età (più mobilità nei giovani)

• costi sociali

• costi vivi

Più opzioni di cura

• chi sceglie?

• chi ha le informazioni?

• il medico?

• il paziente?

Strutture

• adeguato numero di interventi

• attività di ricerca

• bassa mortalità

Soglia minima per gli ospedali

• al di sotto aumenta la mortalità

• collegamenti tra ospedali (rinvii a unità più specializzate)

Comportamento di un paziente ben informato

• “ben informato” da un medico “perfettamente informato” o …

• gradi diversi di informazione Problemi di riferimento: El Farol; scelto locali nelle formiche e comportamenti aggregati