# ABM_HPV

Model was written in NetLogo 6.0
•
Viewed 206 times
•
Downloaded 14 times
•
Run 0 times

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

## WHAT IS IT?

## HOW IT WORKS

## HOW TO USE IT

## THINGS TO NOTICE

## THINGS TO TRY

## EXTENDING THE MODEL

## NETLOGO FEATURES

## CREDITS AND REFERENCES

## HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

- Wilensky, U. (1997). NetLogo AIDS model. http://ccl.northwestern.edu/netlogo/models/AIDS. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Please cite the NetLogo software as:

- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

## COPYRIGHT AND LICENSE

## Comments and Questions

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

Click to Run Model

extensions [nw] ;extensions [r] globals [ infection-chance ;; The chance out of 100 that an infected person will pass on ;; infection during one week of couplehood. symptoms-show ;; How long a person will be infected before symptoms occur ;; which may cause the person to get tested. slider-check-1 ;; Temporary variables for slider values, so that if sliders slider-check-2 ;; are changed on the fly, the model will notice and ; slider-check-3 ;; change people's tendencies appropriately. slider-check-4 initial-people vaccine-rate vaccine-type recruitment-rate natural-death-rate cc-death-rate time ;; time in weeks year infected population n num ] breed [women woman] breed [men man] turtles-own [ infected? ;; If true, the person is infected. It may be known or unknown. known? ;; If true, the infection is known (and infected? must also be true). sane? vaccinated? cancer? virus-type ;; Stands for virus type 1,2,3 or 4 depending on what family pf hpv does it goes alpha 11 , 7, 6, 5 respectively infection-length ;; How long the person has been infected. coupled? ;; If true, the person is in a sexually active couple. couple-length ;; How long the person has been in a couple. ;; the next four values are controlled by sliders commitment ;; How long the person will stay in a couple-relationship. coupling-tendency ;; How likely the person is to join a couple. test-frequency ;; Number of times a person will get tested per year. partner ;; The person that is our current partner in a couple. promiscuity ;; It measures roughly in a scale of 0 to 1, meaning 0 is monogamous and 1 poligamous (completely promiscuous) coupling-efectivity ;;Based on the principle that "el que liga más, liga más" age stage vaccine-lenght ] ;;; ;;; SETUP PROCEDURES ;;; to setup clear-all setup-globals setup-people reset-ticks end to setup-globals set infection-chance 80 ;;hay que revisar la probabilidad de infección en la literatura set symptoms-show 200.0 ;; lo mismo para el tiempo de infeccion set slider-check-1 average-commitment set slider-check-2 average-coupling-tendency set slider-check-4 average-test-frequency set vaccine-rate vr set vaccine-type vaccine set time 0 set recruitment-rate 0.75 set natural-death-rate 0.524 set cc-death-rate 0.0012 set year 0 set population (initial-men + initial-women) end to setup-people set initial-people initial-women + initial-men create-women initial-women ask women [ifelse version ="people"[set shape "person righty"][set shape "triangle"]] create-men initial-men ask men [ifelse version ="people"[set shape "person lefty" ][set shape "circle"]] ask turtles [set vaccinated? false set infected? false set sane? true set cancer? false] ask n-of (floor(initial-women * vaccine-rate)) women [set vaccinated? true] ask n-of (floor((count turtles with [vaccinated? = false]) * random-float 1)) turtles with [vaccinated? = false][set infected? true] ask turtles[ setxy random-xcor random-ycor set known? false set coupled? false set partner nobody set promiscuity random-float 1 set coupling-efectivity random-float 1 set age 13 + random 47 if vaccinated? = true [set vaccine-lenght random 5] if infected? = true [ set virus-type random 4 set infection-length random-float symptoms-show ] assign-commitment assign-coupling-tendency assign-test-frequency] ask women [assign-woman-color] ask men [assign-man-color if vaccine-type = "vac3"[ask n-of (initial-men * vaccine-rate) men [set vaccinated? true ]]] end ;; Different people are displayed in 4 different colors depending on health ;; green is not infected ;; blue is infected but doesn't know it ;; red is infected and knows it ;; grey is vaccinated to assign-man-color ;; turtle procedure ask men [ifelse infected? = true [ifelse known? = true[ set color red + 2 ][set color blue + 2]][ set color green + 2]] ; ask men [ifelse infected? = true and Known? = true[ set color red + 0.2 ][set color green + 0.2]] ; ask men[if infected? = true and known? = false [ set color blue + 0.2] ] end to assign-woman-color ;; turtle procedure ask women [ifelse infected? = true [ifelse known? = true[ set color red - 2 ][set color blue - 2]][ set color green - 2]] ; ask women [if sane? = true ] ;; ask women[ if infected? = true and known? = false ] end to getSick if infected? = true [set stage 1] if infection-length > 50 and random 12 < 6 [set stage 2] if infection-length > 150 and random 12 = 11[set stage 3] if stage = 3 and random 12 < 11 [set cancer? true] if cancer? = true and random 12 = 11[die set pcolor black] end ;; The following four procedures assign core turtle variables. They use ;; the helper procedure RANDOM-NEAR so that the turtle variables have an ;; approximately "normal" distribution around the average values set by ;; the sliders. to assign-commitment ;; turtle procedure set commitment random-near average-commitment end to assign-coupling-tendency ;; turtle procedure set coupling-tendency random-near average-coupling-tendency end ;to assign-condom-use ;; turtle procedure ; set condom-use random-near average-condom-use ;end to assign-test-frequency ;; turtle procedure set test-frequency random-near average-test-frequency end to-report random-near [center] ;; turtle procedure let result 0 repeat 40 [ set result (result + random-float center) ] report result / 20 end ;; Recruitment hay que cambiar como se hace el reclutamiento,debe asignarse a estas tortugas las variables to new-year if time = 52 [cp set time 0 set year year + 1 ask n-of (floor(natural-death-rate * population)) turtles [die set pcolor black] create-women 0.51 * initial-people * recruitment-rate create-men 0.49 * initial-people * recruitment-rate ask women with [xcor = 0 and ycor = 0 ][ifelse version ="people"[set shape "person righty"][set shape "triangle"]] ask men with [xcor = 0 and ycor = 0 ][ifelse version ="people"[set shape "person lefty"][set shape "circle"]] ask turtles with [xcor = 0 and ycor = 0 ][set vaccinated? false set infected? false set sane? true set cancer? false] ask n-of (floor((count women with [xcor = 0 and ycor = 0]) * vaccine-rate)) women with [xcor = 0 and ycor = 0 ] [set vaccinated? true] ; ask n-of (floor(initial-women * vaccine-rate)) women [set vaccinated? true] ask n-of (floor((count turtles with [xcor = 0 and ycor = 0 and vaccinated? = false]) * random-float 1)) turtles with [xcor = 0 and ycor = 0 and vaccinated? = false][set infected? true] ask turtles with [xcor = 0 and ycor = 0 ][ setxy random-xcor random-ycor set known? false set coupled? false set partner nobody set promiscuity random-float 1 set coupling-efectivity random-float 1 set age 13 + random 47 if vaccinated? = true [set vaccine-lenght random 5] if infected? = true [ set virus-type random 4 set infection-length random-float symptoms-show ] assign-commitment assign-coupling-tendency ; assign-condom-use assign-test-frequency] ask women [assign-woman-color] ask men [assign-man-color if vaccine-type = "vac3"[ask n-of (initial-men * vaccine-rate) men [set vaccinated? true ]]]] end ;;; ;;; GO PROCEDURES ;;; to go if all? turtles [known? = true] [ stop ] check-sliders ask patches[if turtles-here = 0 [set pcolor black]] ask turtles [ if infected? = true [ set infection-length infection-length + 1 ] if coupled? = true [ set couple-length couple-length + 1 ] ] ask turtles [ if coupled? = false [ move ] ] ;; Righties are always the ones to initiate mating. This is purely ;; arbitrary choice which makes the coding easier. ask women [ if coupled? = false and (random-float 10.0 < coupling-tendency) [ couple ] ] ask turtles [ uncouple ] ask turtles [ infect ] ask turtles [ test ] ask turtles [getSick] ask men [ assign-man-color ] ask women [ assign-woman-color ] ;file-open "red_contactos.txt" nw:set-context turtles links ;ask women [ file-write map sort nw:get-context ] tick set time time + 1 new-year ask turtles [set age age + year] set population (count turtles) ask turtles with [coupled? = true][if partner = nobody[set coupled? false]] set n random 100 set num (word n) if time = 50 [nw:save-matrix (word "matriz" num ".txt")] end ;; Each tick a check is made to see if sliders have been changed. ;; If one has been, the corresponding turtle variable is adjusted to check-sliders if (slider-check-1 != average-commitment) [ ask turtles [ assign-commitment ] set slider-check-1 average-commitment ] if (slider-check-2 != average-coupling-tendency) [ ask turtles [ assign-coupling-tendency ] set slider-check-2 average-coupling-tendency ] if (slider-check-4 != average-test-frequency ) [ ask turtles [ assign-test-frequency ] set slider-check-4 average-test-frequency ] end ;; People move about at random. to move ;; turtle procedure ifelse version = "people" [rt random-float 360 fd 1] [fd 1] end ;; People have a chance to couple depending on their tendency to have sex and ;; if they meet. To better show that coupling has occurred, the patches below ;; the couple turn gray. to couple ;; turtle procedure -- righties only! let potential-partner one-of (men-at -1 0) with [coupled? = false] if potential-partner != nobody [ if random-float 10.0 < [coupling-tendency] of potential-partner and coupling-efectivity > 0.6 [ set partner potential-partner if relacion = true [create-link-with partner] set coupled? true ask partner [ set coupled? true ] ask partner [ set partner myself ] move-to patch-here ;; move to center of patch ask potential-partner [move-to patch-here] ;; partner moves to center of patch set pcolor gray - 3 ask (patch-at -1 0) [ set pcolor gray - 3 ] ] ] if turtles-here = nobody [set pcolor black] end ;; If two peoples are together for longer than either person's commitment variable ;; allows, the couple breaks up. to uncouple ;; turtle procedure ask women [if coupled? = true [ if (couple-length > commitment) or ([couple-length] of partner) > ([commitment] of partner) or promiscuity > 0.7 [ set coupled? false set couple-length 0 ask partner [ set couple-length 0 ] set pcolor black ask (patch-at -1 0) [ set pcolor black ] ask partner [ set partner nobody ] ask partner [ set coupled? false ] set partner nobody ] ]] end ;; Infection can occur if either person is infected, but the infection is unknown. ;; This model assumes that people with known infections will continue to couple, ;; but will automatically practice safe sex, regardless of their condom-use tendency. ;; Note also that for condom use to occur, both people must want to use one. If ;; either person chooses not to use a condom, infection is possible. Changing the ;; primitive to AND in the third line will make it such that if either person ;; wants to use a condom, infection will not occur. to infect ;; turtle procedure if coupled? = true and infected? = true and known? = false and vaccinated? = false [ if random-float 100 < infection-chance [ ask partner [ set infected? true ] ] ] ;] if vaccine-type = "vac1"[ if coupled? = true and infected? = true and known? = false and [vaccinated?] of partner = true and [vaccine-lenght] of partner < 2 and virus-type > 2 [ if random-float 100 < infection-chance [ ask partner [ set infected? true ] ] ] ] if vaccine-type = "vac2"[ if coupled? = true and infected? = true and known? = false and [vaccinated?] of partner = true and [vaccine-lenght] of partner < 2 and virus-type = 3 [ if random-float 100 < infection-chance [ ask partner [set infected? true ] ] ] ];] end ;; People have a tendency to check out their health status based on a slider value. ;; This tendency is checked against a random number in this procedure. However, after being infected for ;; some amount of time called SYMPTOMS-SHOW, there is a 5% chance that the person will ;; become ill and go to a doctor and be tested even without the tendency to check. to test ;; turtle procedure if random-float 52 < test-frequency [ if infected? = true [ set known? true ] ] if infection-length > symptoms-show [ if random-float 100 < 5 [ set known? true ] ] end ;;; ;;; MONITOR PROCEDURES ;;; to-report %infected ifelse any? turtles [ report (count turtles with [infected? = true] / count turtles) * 100 ] [ report 0 ] end to-report %vaccinated ifelse any? women [ report (count women with [vaccinated? = true] / count women) * 100 ] [ report 0 ] end to-report global-clustering-coefficient let closed-triplets sum [ nw:clustering-coefficient * count my-links * (count my-links - 1) ] of turtles let triplets sum [ count my-links * (count my-links - 1) ] of turtles report closed-triplets / triplets end

There is only one version of this model, created almost 4 years ago by Augusto Cabrera-Becerril.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

ABM_HPV.png | preview | Preview for 'ABM_HPV' | almost 4 years ago, by Augusto Cabrera-Becerril | Download |

This model does not have any ancestors.

This model does not have any descendants.