Obesity
Model was written in NetLogo 6.0.2
•
Viewed 296 times
•
Downloaded 26 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
breed [females female] breed [males male] breed [dieticians dietician] turtles-own [ male_height_squared ; how tall a male person is in metres squared for calculation of BMI female_height_squared ; how tall a female person is in metres squared for calculation of BMI male_weight ; the weight of a male person in kg female_weight ; the weight of a female person in kg BMI_male ; the body mass index of a male to indicate underweight, healthy, overweight or obese BMI_female ; the body mass index of a female to indicate underweight, healthy, overweight or obese pride-shame gratification-remorse health-consciousness male_pride-shame female_pride-shame male_economic_class ;males are placed in an intial economic class female_economic_class ;females are placed in an intial economic class male_attitude ;individual attitude towards health(exercise) female_attitude ;individual attitude towards health(exercise) male_pbc ;male perceived behavioral control female_pbc ;female perceived behavioral control male_vision ;how far a male sees female_vision ;how far a female sees male_total_seen ;total number of males seen in turtle's vision female_total_seen ;total number of females seen in turtle's vision male_healthy_seen ;indicates if a healthy male is seen female_healthy_seen ;indicates if a healthy female is seen male_subjective_norm ;indicates a males SN value female_subjective_norm ;indicates a females SN value male_intention ;indicates a males total likelihood to engage in healthy behavior female_intention ;indicates a females total likelihood to engage in healthy behavior newmale_weight ;calculation of new male weight after each tick newfemale_weight ;calculation of new female weight after each tick my-group ; turtle group friends_total friends_healthy friends_influence male_emotions female_emotions just-exercised ] to setup clear-all ;;set global variables to appropriate values setup-patches setup-turtles assign-turtle-groups reset-ticks end to setup-patches ask patches [ set pcolor pink ] ;set patches to color pink end to go move-turtles ;moving around exercise-turtles ;exercise is used to mean "engage in healthy behavior (i.e. eat healthily and exercise) update-turtles ;give them their new weight all at once recolor-turtles ;recalculate BMI and assign new categories tick end to move-turtles ;this allows turtles to move in a random direction ask turtles [ ifelse (random 100 < movement) ;controls for movement in society with slider [ right random 360 forward 1] [forward 0] ] end to setup-turtles set-default-shape turtles "person" create-males number / 2 [ setxy random-xcor random-ycor set male_height_squared random-normal 3.103219 .2077 ;setting initial male height squared to calculate BMI set male_weight random-normal (72.1212 * starting-weight) 4.2335 ;initializing male's random weight set male_pride-shame max (list(min (list (random-normal .4 .2)1) )0) ;initializing male's random body image set male_economic_class min( list (random-exponential (1 / 2)) 1) ;initializing male'seconomic class set male_vision vision set just-exercised 0 ifelse (random-float 100 < health-awareness) [set health-consciousness 1] [set health-consciousness 0] ] ; initializing male vision create-females number / 2 [ setxy random-xcor random-ycor set female_height_squared random-normal 2.757414 0.1957 ;initializing female height squared to calculate BMI set female_weight random-normal (61.4618 * starting-weight) 4.0067 ;initializing female's random weight set female_pride-shame max (list(min (list (random-normal .4 .2)1) )0) ;initializing female's random body image set female_economic_class min( list (random-exponential (1 / 2)) 1) ;initializing female's random economic class set female_vision vision ifelse (random-float 100 < health-awareness) [set health-consciousness 1] [set health-consciousness 0] ] ;initializing female vision set-default-shape turtles "person" create-dieticians dietician-number [setxy random-xcor random-ycor set color white set just-exercised 0 ] end to exercise-turtles ask males [set male_attitude (male_pride-shame - 2 * gratification-remorse) ;for now, attitude is just related to body image and does not change over time set male_pbc .4 * (max (list(min (list (random-normal male_economic_class .4) 1)) 0)) + random-float .7 ;behavioral control cares about economic class, but also has some random noise ask turtles in-radius male_vision ;how many total turtles are seen [set male_total_seen count males in-radius male_vision + count females in-radius male_vision set male_healthy_seen (count males in-radius male_vision with [BMI_male < 25]) + (count females in-radius male_vision with [BMI_female < 25])] ;how many healthy turtles are seen ask turtles with [my-group = [my-group] of myself] ;how many total turtles are seen [set friends_total (count males with [my-group = [my-group] of myself] + count females with [my-group = [my-group] of myself]) set friends_healthy (count males with [BMI_male < 25 and my-group = [my-group] of myself]) + (count females with [BMI_female < 25 and my-group = [my-group] of myself])] set friends_influence (friends_healthy / friends_total) set male_subjective_norm ((0.5 + (min (list male_total_seen 20))* (.05) *((male_healthy_seen / male_total_seen) - 0.5)) + friends_influence) set male_intention min (list (.4718 * male_attitude + .2554 * male_subjective_norm + .2728 * male_pbc) 1) ;assigns weights calculated from Godin review ifelse (random-float 1 < male_intention) ;likelihood to exercise doesn't guarantee exercise - random float allows for disparity between intention and behavior [ ifelse (BMI_male > (20)) [set newmale_weight (male_weight - random-float .1) set just-exercised 1] ;people above BMI of 20 will continue to lose weight when engaging in healthy behavior [set newmale_weight (male_weight + random-float .01 - random-float .01) set just-exercised 1] ;people at or below BMI of 20 will fluctuate around their current weight ifelse (health-consciousness = 1) [set gratification-remorse .5] [set gratification-remorse .1] ] [ ifelse(random-float 1 < .75) ;possible either to stay the same weight or gain weight when not healthy [set newmale_weight (male_weight + random-float 0.1) set just-exercised 0] ;weight gain is random between 0 and 0.1 [set newmale_weight (male_weight) set just-exercised 0] ;possible to remain same weight ifelse (health-consciousness = 1) [set gratification-remorse -.5] [set gratification-remorse .5]] ifelse (random-float 1 < .01) [set health-consciousness (1 - health-consciousness)] [set health-consciousness health-consciousness] ifelse (count dieticians in-radius male_vision > 0) [set health-consciousness 1] [set health-consciousness health-consciousness]] ask females ;female procedure is identical to males above [set female_attitude (female_pride-shame - 2 * gratification-remorse) set female_pbc .4 * (max (list(min (list (random-normal female_economic_class .4) 1)) 0)) + random-float .7 ask turtles in-radius female_vision [set female_total_seen count males in-radius female_vision + count females in-radius female_vision set female_healthy_seen (count males in-radius female_vision with [BMI_male < 25]) + (count females in-radius female_vision with [BMI_female < 25])] ask turtles with [my-group = [my-group] of myself] ;how many total turtles are seen [set friends_total (count males with [my-group = [my-group] of myself] + count females with [my-group = [my-group] of myself]) set friends_healthy (count males with [BMI_male < 25 and my-group = [my-group] of myself]) + (count females with [BMI_female < 25 and my-group = [my-group] of myself])] set friends_influence (friends_healthy / friends_total) set female_subjective_norm ((0.5 + (min (list female_total_seen 20))* (.05) *((female_healthy_seen / female_total_seen) - 0.5)) + friends_influence) set female_intention min (list (.4718 * female_attitude + .2554 * female_subjective_norm + .27728 * female_pbc) 1) ifelse (random-float 1 < female_intention) [ ifelse (BMI_female > (20)) [set newfemale_weight (female_weight - random-float .1) set just-exercised 1] [set newfemale_weight (female_weight + random-float .01 - random-float .01) set just-exercised 1] ifelse (health-consciousness = 1) [set gratification-remorse .5] [set gratification-remorse .1] ] [ ifelse(random-float 1 < .75) [set newfemale_weight (female_weight + random-float 0.1) set just-exercised 0] [set newfemale_weight (female_weight) set just-exercised 0] ifelse (health-consciousness = 1) [set gratification-remorse -.5] [set gratification-remorse .5] ] ifelse (random-float 1 < .01) [set health-consciousness (1 - health-consciousness)] [set health-consciousness health-consciousness] ifelse (count dieticians in-radius female_vision > 0) [set health-consciousness 1] [set health-consciousness health-consciousness] ] end to update-turtles ask males [set male_weight newmale_weight ;all weights update at once set male_economic_class max ( list (min (list(male_economic_class + (social_mobility * .0001 * random-float 1) - (social_mobility * .0001 * random-float 1)) 1 )) 0) ] ;depending on social mobility slider, people can move from one economic class to another (albeit slowly) ask females [set female_weight newfemale_weight set female_economic_class max ( list (min (list(female_economic_class + (social_mobility * .0001 * random-float 1) - (social_mobility * .0001 * random-float 1)) 1 )) 0) ] end to recolor-turtles ask males [ set BMI_male newmale_weight / male_height_squared ; calculation of BMI to categorize health(underweight, healthy, overweight and obese) ifelse (BMI_male < 18.4) [set color yellow] ;; underweight individuals set yellow [ ifelse ( 18.4 <= BMI_male and BMI_male <= 24.9) [set color green] ;; healthy eating set green [ifelse ( 25 <= BMI_male and BMI_male <= 29.9) [set color blue] ;;overweight individuals set blue [if ( BMI_male > 30) [set color red] ;;obese individuals set red ] ] ] ] ask females [ set BMI_female newfemale_weight / female_height_squared ; calculation of BMI to categorize health(underweight, healthy, overweight and obese) ifelse (BMI_female < 18.4) [set color yellow] ;; underweight individuals set yellow [ ifelse ( 18.4 <= BMI_female and BMI_female <= 24.9) [set color green] ;; healthy eating set green [ifelse ( 25 <= BMI_female and BMI_female <= 29.9) [set color blue] ;;overweight individuals set blue [ifelse ( BMI_female > 30) [set color red] ;;obese individuals set red [] ] ] ] ] end ;;; this procedure randomly assigns turtles to groups based on the desired ;;; size of the groups. all the groups will have the desired size except for ;;; at most one group, which contains the remainder of the turtles. more ;;; formally, if there are n turtles, and the desired group size is k, this ;;; procedure will produce j = floor (n / k) groups of k turtles, and if ;;; n mod k > 0, it will produce one group of n mod k turtles. to assign-turtle-groups ;; all turtles are initially ungrouped ask turtles [ set my-group -1 ] let unassigned turtles ;; start with group 0 and loop to build each group let group-number 0 while [any? unassigned] [ ;; place a randomly chosen set of group-size turtles into the current ;; group. or, if there are less than group-size turtles left, place the ;; rest of the turtles in the current group. ask n-of (min (list group-size (count unassigned))) unassigned [ set my-group group-number ] ;; consider the next group. set group-number group-number + 1 ;; remove grouped turtles from the pool of turtles to assign set unassigned unassigned with [my-group = -1] ] end
There is only one version of this model, created over 5 years ago by Cal Newlon.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Obesity.png | preview | Preview for 'Obesity' | over 5 years ago, by Cal Newlon | Download |
This model does not have any ancestors.
This model does not have any descendants.