190 likes | 383 Views
Pietro Terna pietro.terna@unito.it Dipartimento di scienze economiche e finanziarie “G.Prato” Università di Torino - Italia Master in Economia e politica sanitaria 2007-2008 Simulazione per la sanità – 5/5
E N D
Pietro Terna pietro.terna@unito.it Dipartimento di scienze economiche e finanziarie “G.Prato” Università di Torino - Italia Master in Economia e politica sanitaria 2007-2008 Simulazione per la sanità – 5/5 web.econ.unito.it/terna web.econ.unito.it/terna/materiale/master_ec_pol_san/ copertina Master in economia e politica sanitaria - Simulazione per la sanità
Master in economia e politica sanitaria - Simulazione per la sanità
§ 5.1 Master in economia e politica sanitaria - Simulazione per la sanità
_Strumenti, seguito _______________________________________ Simulazione in NetLogo ospedali_402.nlogo in linea a http://web.econ.unito.it/terna/materiale/master_ec_pol_san/ anche in linea funzionante a http://web.econ.unito.it/terna/mastersan _______________________________________ Master in economia e politica sanitaria - Simulazione per la sanità
Il problema della mobilità dei pazienti oncologici problema da trattare • Più opzioni di cura • chi sceglie? • chi ha le informazioni? • il medico? • il paziente? • 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 • 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 Master in economia e politica sanitaria - Simulazione per la sanità
ospedali.nlogo Master in economia e politica sanitaria - Simulazione per la sanità
ospedali.nlogo WHAT IS IT? ----------- Simulazione di pazienti che si spostano di ospedale in ospedale. L'ospedale normale è bianco. Se un ospedale ha pochi pazienti e quindi rappresenta un punto critico, è segnalato in rosso; se decresce, è segnalato in blu; se diventa troppo grande, in verde. Se il paziente non è a suo agio, cambia ospedale, spostandosi a caso nell'ospedale che si trova a sinistra o a destra; resta in situazione di disagio se incontra un ospedale non bianco. I pazienti in condizione di disagio sono indicati in rosso. HOW TO USE IT ------------- Provare a modificare una per volta le probabilità di cambiamento di situazione (agio/disagio) del paziente: cambiamento a caso; cambiamento se in ospedale rosso, blu o verde. Provare combinazioni diverse di tutte le probabilità. Osservare il formarsi di zone di ospedali in crisi. Master in economia e politica sanitaria - Simulazione per la sanità
_______________________________________ Esaminiamo il codice, esaminiamo la possibilità di inserire nuove caratteristiche, di utilizzare avatar, di impiegare l’apprendimento _______________________________________ Master in economia e politica sanitaria - Simulazione per la sanità
Ritorniamo a una classificazione già vista all’inizio • modelli letterario-descrittivi • modelli matematico-statistici • modelli di simulazione nel computer, come artefatti a utilizzare per … Master in economia e politica sanitaria - Simulazione per la sanità
; ospedali versione per NetLogo 4, maggio 2008 ;; gli agenti scelgono un gruppo; lo lasciano se sono uneasy turtles-own [uneasy?] patches-own [people people-previous-value decreasing? huge?] globals [critical-groups decreasing-groups huge-groups moves number-uneasy 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" crt number [ set uneasy? false set color white ifelse (random 2 = 0) [set heading 90] [set heading 270] ;; randomly face right or left set ycor 0 set xcor random world-width] Master in economia e politica sanitaria - Simulazione per la sanità
ask turtles [move-into-groups] setup-patches update-critical-or-decreasing-or-huge-groups update-uneasiness setup-plots set moves 0 update-labels spread-people update-plots end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ to go if (number-uneasy = number) [ show "Catastrophe!" stop ;; stop the simulation if everyone is uneasy ] group-people ;; put all people on the x-axis move-if-uneasy update-critical-or-decreasing-or-huge-groups update-labels update-uneasiness spread-people ;; move the people into vertical columns set moves (moves + 1) update-plots if limit-speed? [ wait 0.2 ] end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ to setup-patches ask patches [ set people-previous-value 0 set people 0 set decreasing? false set huge? false] ask turtles [set people (people + 1)] end ;------------------------------------------------------ ;------------------------------------------------------ to update-labels ask group-sites [ set plabel count turtles-here ] ; plabel is a patch 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 ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ to update-uneasiness ask turtles [ if plabel-color = white [set uneasy? false set color white] ; clear mood if (100 * p-of-random-mood-change) > random 100 [set uneasy? true set color red] if (100 * p-of-mood-change-if-critical) > random 100 and plabel-color = red [set uneasy? true set color red] if (100 * p-of-mood-change-if-decreasing) > random 100 and plabel-color = blue [set uneasy? true set color red] if (100 * p-of-mood-change-if-huge) > random 100 and plabel-color = green [set uneasy? true set color red] ] set number-uneasy count turtles with [uneasy?] ;; update number-uneasy variable end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ to move-if-uneasy ask turtles [ if (uneasy?)[ ifelse (random 2 = 0) [set heading 90] [set heading 270] ;; randomly face right or left set people (people - 1) ;;decrease the count in your old group fd 1 ;; move out of your group move-into-groups set people (people + 1)] ;;increase the count in your new group ] end ;------------------------------------------------------ ;------------------------------------------------------ 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.02 ] ;; slow it down so user can see it happening move-into-groups] end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ 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) let group-interval 0 ;; 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 ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ to update-critical-or-decreasing-or-huge-groups ask group-sites [ set plabel-color white ifelse people < people-previous-value [set decreasing? true] [set decreasing? false] set people-previous-value people if decreasing? [set plabel-color blue] if people < number / (1.3 * (count group-sites)) [set plabel-color red] if people > number / (0.5 * (count group-sites)) [set plabel-color green] ] set critical-groups (count group-sites with [plabel-color = red]) set decreasing-groups (count group-sites with [plabel-color = blue]) ;NB a decreasing group can be accounted also as critical set huge-groups (count group-sites with [plabel-color = green]) ;NB a huge group can be accounted also as decreasing end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ to setup-plots set-current-plot "Uneasy People" set-plot-y-range 0 number set-current-plot "Critical or Decreasing or Huge Groups" set-plot-y-range 0 num-groups end ;------------------------------------------------------ ;------------------------------------------------------ to update-plots set-current-plot "Uneasy People" set-current-plot-pen "Uneasy" plot (count turtles with [uneasy?]) set-current-plot "Critical or Decreasing or Huge Groups" set-current-plot-pen "Critical-groups" plot critical-groups set-current-plot-pen "Decreasing-groups" plot decreasing-groups set-current-plot-pen "Huge-groups" plot huge-groups end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità
;------------------------------------------------------ ;; spread people out vertically to spread-people ask turtles [ set heading 0 fd (4 + count other turtles-here) ] ;; this trick works ;; because the turtles remaining in the ;; starting point is decreasing as ;; they move away end ;------------------------------------------------------ ;------------------------------------------------------ ;; pile people up on the x-axis to group-people ask turtles [set ycor 0] end ;------------------------------------------------------ Master in economia e politica sanitaria - Simulazione per la sanità