Trendsetting

No preview image

1 collaborator

Default-person Kristen Amaddio (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2015 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 406 times • Downloaded 34 times • Run 0 times
Download the 'Trendsetting' modelDownload this modelEmbed this model

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

globals [color-mode] ;; 0 = default, 1 = source, 2 = times heard, 3 = popularity

turtles-own [popularity trendy? trend-setter? interest-category trend-category trend-source times-heard]
;; popularity is a number value representing the degree of each turtle
;; trendy? is a boolean that is true if the person follows the trend
;; trend-setter? is a boolean that is true if the person is seeded the trend (i.e. the overall trend-starter)
;; interest-category is an integer representing the type of things the person is interested in
;; trend-category is an integer that represents the inherent type of thing a trend is 
;; (corresponds with same values as interest-category) if the person is carrying a trend.
;; trend-source tells whether the turtle followed a trend from a friend, from the media, or both.
;; times-heard counts how many times a turtle has heard a meme

patches-own [category]
;; category is an integer that represents the inherent type of thing a trend is 
;; (corresponds with same values as trend-category of a person)

;; Create people and links.

to setup
  ca
  set color-mode 0 ;; default
  create-turtles population [
    set shape "person"
    set color blue ;; default "no-trend" color is blue
    setxy random-xcor random-ycor
    set interest-category random 10 ;; an "interest type" corresponding to one of 0-9
    set trend-category -1 ;; -1 corresponds with "no trend"
    set times-heard 0
  ]
  repeat population [
    ask one-of turtles [
      create-link-with one-of other turtles
    ]
  ]
  ask turtles [
    set popularity count my-links
  ]
  ask patches [
    set category -1 ;; -1 corresponds with "no trend", i.e. this patch is not a TV
  ]
  reset-ticks
end 

;; seed a trend to one random person

to seed-trend
  ask one-of turtles [
    set color red
    set trendy? true
    set trend-setter? true
    set trend-category interest-category ;; trend is given a "type" corresponding to the turtle's interest
    set times-heard 1
    set size 1.5 ;; distinguish the trend-setter
  ]
end 

;; run the model

to go
  ask turtles with [trendy? = true][ ;; ask the trendy turtles to spread the trend
    spread-trend
  ]
  ;; if media is turned on, every  ticks a TV will flash in a patch with a turtle on it.
  if media?[
    if ticks mod (media-frequency / 2) = 0 [
      ask one-of patches with [count turtles-here > 0] [
        media-trend
      ]
    ]
    if ticks mod media-frequency = 0 [
      ask patches with [pcolor = white][
        set category -1
        set pcolor black
      ]
    ]
  ]
  recolor
  tick
end 

;; spreading the trend

to spread-trend
  let target nobody
  set target one-of link-neighbors
  if target != nobody [
    ask target [
      ;; diff represents the difference between the turtle's interest category and the category of the trend.
      ;; the smaller the difference, the higher the probability that the trend will be passed to that turtle.
      ;; (i.e. if difference = 0, random number is chosen between 0 and 9. if difference = 9, random number is chosen between 0 and 99
      let diff (interest-category - [trend-category] of myself)
      if 0 = random (10 * (1 + (abs diff))) [
        set color red
        set trendy? true
        ;; if the turtle has already adopted the trend from media, 
        ;; leave it be. otherwise, set its source to "friend"
        if trend-source != "media" [
          set trend-source "friend"
        ]
        set trend-category [trend-category] of myself
      ]
      set times-heard times-heard + 1
    ]
    ;; if a trend spreads between 2 turtles, turn the link between them red
    ask links [
      if all? both-ends [trendy? = true]
        [ ifelse color-mode = 0 or color-mode = 1
          [set color red]
          [ifelse color-mode = 2
            [set color blue]
            [set color 83]
          ]
        ]
    ]
  ]
end 

;; when media? is true, patches run this procedure, representing TV-watching.
;; assume that a turtle will accept a trend regardless of category with media exposure

to media-trend
  set pcolor white ;; the turtle watches TV
  ;; the TV broadcasts the current trend
  set category [trend-category] of one-of turtles with [trend-setter? = true]
  let watcher one-of turtles-here
  if watcher != nobody [
    ask watcher[
      set color red
      set trendy? true
      set times-heard times-heard + 1
      ;; if the turtle has already adopted the trend from a friend, 
      ;; leave it be. otherwise, set its source to "media"
      if trend-source != "friend" [
        set trend-source "media"
      ]
      set trend-category [category] of myself     
    ]
  ]
end 
  
;; procedure to recolor to the default scheme -- color-mode = 0

to recolor-default
  ask turtles [
    ifelse trendy? = true
      [set color red]
      [set color blue]
  ]
  ask patches with [category = -1] [set pcolor black]
  ask links with [color = 83 or color = blue] [set color red]
end 

;; procedure to recolor to show source (friend vs media) -- color-mode = 1

to recolor-by-source
  ask patches with [category = -1] [set pcolor black]
  ask turtles with [trend-source = "media"] [set color yellow]
  ask turtles with [trend-source = "friend"] [set color red]
  ask turtles with [trend-source = 0] [set color blue]
  ask links with [color = 83 or color = blue] [set color red]
end 

;; procedure to recolor to display the number of times heard -- color-mode = 2

to recolor-by-times-heard
  ask patches with [category = -1] [set pcolor 3]
  ask turtles [set color scale-color green times-heard 0 world-width * 2]
  ask links with [color = red or color = 83] [set color blue]
end 

;; procedure to recolor to show popularity levels -- color-mode = 3

to recolor-by-popularity
  ask patches with [category = -1] [set pcolor 3]
  ask turtles [set color scale-color violet popularity 0 world-width * 2]
  ask links with [color = red or color = blue] [set color 83]
end 

;; procedure to recolor while the "go" function is running

to recolor
  ifelse color-mode = 0
    [recolor-default]
    [ ifelse color-mode = 1
      [recolor-by-source]
      [ifelse color-mode = 2
        [recolor-by-times-heard]
        [recolor-by-popularity]
      ]
    ]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Kristen Amaddio over 9 years ago Fixed the placement of "times-heard" increment Download this version
Kristen Amaddio over 9 years ago More randomness, more accurate distributions and processes, different color options, more analysis Download this version
Kristen Amaddio over 9 years ago Added in more randomness, as well as a media aspect. Download this version
Kristen Amaddio over 9 years ago Initial upload Download this version

Attached files

File Type Description Last updated
KristenAmaddio_June1.docx word Progress Report 3 over 9 years ago, by Kristen Amaddio Download
KristenAmaddio_May18.docx word KristenAmaddio_May18 over 9 years ago, by Kristen Amaddio Download
KristenAmaddio_May25.docx word Progress Report 2 over 9 years ago, by Kristen Amaddio Download

This model does not have any ancestors.

Children:

Graph of models related to 'Trendsetting'