Homophily Choice

Homophily Choice preview image

1 collaborator

Default-person Chao Yu (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 539 times • Downloaded 160 times • Run 0 times
Download the 'Homophily Choice' modelDownload this modelEmbed this model

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


WHAT IS IT?

This model simulates the influence of racial homophily in sharing economy accommodations (like AirBnB). In this simulation, we can see how how guests' racial homophily (guests' preference for same-race hosts and guests' preference for same-race reviewers who previously stayed) influence their choices of hosts.

Racial groups and their icon colors: White = Blue; Black = Grey; Asian = Orange.

HOW IT WORKS

First, we can set the proportion of hosts (house icon) by race on the market.

Second, the guests (person icon) enter in the market by probability (can be adjusted during the model run). The probabilities of guests of different races entering the market sum up to 1. We only need to adjust the first two probabilities and the third one will be displayed automatically.

Third, the guests' choices of hosts are based on 1) guest-host homopihily and 2) guest-reviewer homophily.

1) Guest-host homopihilies are displayed under "Guest-host homophily proportion (sum=1)". "w" = "Whhite", "b" = "Black", and "a" = "Asian". The first "w/b/a" means the racial groups for guests, while the second "w/b/a" means the racial groups for hosts. The last digit means this it the first type of homophily preference. Thus, "w-w-1" means "White guests' preference for White hosts".

For the guest-host homopihily, we can set how a guest of a specific race will choose a host based on their racial groups. For instance, the default setting is that the probability of guests' choosing same-race hosts is double (0.5) as the probability of choosing different-race hosts (0.25).

2) Guest-reviewer homophily variables are displayed under "Guest-reviewer homophily proportion (sum=1)". Similarly, "w" = "Whhite", "b" = "Black", and "a" = "Asian". The first "w/b/a" means the racial groups for guests, while the second "w/b/a" means the racial groups for hosts. The last digit means this it the second type of homophily preference. Thus, "w-w-2" means "White guests' preference for the ratio of previous White reviewers".

For the guest-reviewer homophily, we can set how a guest of a racial group will be influenced by the ratio of previous reviewers from a specific racial group. Our assumption is that the more a guest sees a place being stayed by people from their own racial groups, the more likely they are going to choose this place (host). In other words this type of homophily is the extent to which White/Black/Asian guests prefer to stay with hosts that have already been stayed by other White/Black/Asian guests. In our default setting, the extent is double for same-race reviewers as different-race reviewers.

Both types of homophily preferences can be adjusted while the model is running.

The three plots from the top to the bottom are: the average number of guests by hosts' racial groups; the Lorenz Curve in terms of the distribution of the number of guests; the Gini-index in terms of the distribution of the number of guests. All of the three plots will change over ticks/time.

HOW TO USE IT

Before running the model, we need to set up the number of hosts by race on the market. This should be done BEFORE running the model and cannot be adjusted when the model is running. By default, we set the number of White, Black, Asian hosts as 25, 25, 25.

Next, we can adjust the proportion of guests of a specific racial group that enter into the market. By default, we set proportion of White:Black:Asian guests as 0.5: 0.25: 0.25

Then, we can adjust the 1) guest-host homopihily and 2) guest-reviewer homophily. By default, we set guests' preference for same-race hosts and reviewers double as their preference for different-race hosts and reviewers.

After the above settings, we can choose to "go once" for trial run or "go forever" to see the simulation over ticks.

THINGS TO NOTICE

It is important to know that we should make sure the proportions in each category add up to 1. In most cases, Netlogo will automatically make this adjustment, but in some cases, it will not and needs to be refreshed by moving the sliders.

THINGS TO TRY

We can tweak the model with different combinations of four groups of variables: host number/distribution, guest distribution, guest-host homopihily and guest-reviewer homophily. Again, host number/distribution cannot be adjusted during the model run but others can.

To what extent the population distribution by race lead to uneuqal performance of hosts. Specifically, how will the hosts from the majority group benefit solely by this population distribution?

We can make the two types of homophilies become racial biases by setting guests' preference for a specific group to a very small value (e.g., 0.8:0.19:0.01). We thus can explore the influence of racial discrimination on the performance (number of guests received) of hosts over time.

EXTENDING THE MODEL

We can extend this model by adding other variables that influence people's homophily preferences such as room types and prices. However, here we solely want to focus on the choices people would make based on racial homophily, assuming other things being equal.

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

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

Click to Run Model

globals [
  guest-count
  host-count
  choice
  gini-index-reserve
  lorenz-points
]

;extensions [ import-a ]
;extensions [ rnd ]


breed [hosts host]
breed [guests guest]
breed [trees tree]

hosts-own [
  h-race
  ;w-b-a-ratio
  w-ratio
  b-ratio
  a-ratio
  w-cnt
  b-cnt
  a-cnt
  attract
  num-guest
]

guests-own [
  g-race
  cate
]

to setup
  clear-all
  ask patches [set pcolor green - random-float 0.5]

  ;ask patches [set pcolor 56 ]
  ;import-drawing "map.jpg"
  set-default-shape guests "person"
  set-default-shape hosts "house"

  set host-count (white-hosts + black-hosts + asian-hosts)
  set guest-count (white-hosts + black-hosts + asian-hosts)


  ;;add number of hosts according to the input
  create-hosts white-hosts [
    set size 2
    set h-race "White"
    set color 105 ;; white = 105
    set xcor -20 + random 40
    set ycor -20 + random 50


  ]

  create-hosts black-hosts [
    set size 2
    set h-race "Black"
    set color 3 ;; grey = 3
    set xcor -20 + random 40
    set ycor -20 + random 50

  ]

  create-hosts asian-hosts [
    set size 2
    set h-race "Asian"
    set color 25 ;; yellow = 45
    set xcor -20 + random 40
    set ycor -20 + random 50

  ]
  ;;set hosts apart for visual purpose
  ask hosts [move-to one-of patches with [not any? other hosts in-radius 2]]
  update-lorenz-and-gini
  reset-ticks
end 

to go

  ;; update the ratio for all hosts based on the guest race
  ask hosts [
    if count link-neighbors > 0 [
    ;set w-b-a-ratio (list ((count (link-neighbors with [g-race = "White"])) / count link-neighbors)
      ;((count (link-neighbors with [g-race = "Black"])) / count link-neighbors)
      ;((count (link-neighbors with [g-race = "Asian"])) / count link-neighbors) )
    set w-ratio count (link-neighbors with [g-race = "White"])/ count link-neighbors
    set b-ratio count (link-neighbors with [g-race = "Black"])/ count link-neighbors
    set a-ratio count (link-neighbors with [g-race = "Asian"])/ count link-neighbors

    set w-cnt count (link-neighbors with [g-race = "White"])
    set b-cnt count (link-neighbors with [g-race = "Black"])
    set a-cnt count (link-neighbors with [g-race = "Asian"])
    ]
    set num-guest count (link-neighbors)
  ]


  ask links [ set color gray ]
  set guest-count (guest-count + 1)

  create-guest
  make-decision find-partner
  ;;decide the race of a guest by probability

  update-lorenz-and-gini
  tick
end 


;; used for creating a new guest

to create-guest
  create-guests 1 [
      ;set new? true
      let a-g-prob 1 - w-g-prob - b-g-prob
      let probs ( list (w-g-prob) (b-g-prob) (a-g-prob) )
      ;let race-col [ "White" "Black" "Asian" ]
      ;set g-race first rnd:weighted-one-of-list (map list race-col probs) last
      set g-race (random-pick-guest-race probs)
      if g-race = "White" [set color 105 set cate 1]
      if g-race = "Black" [set color 3 set cate 2]
      if g-race = "Asian" [set color 25 set cate 3]


    ]
end 

to make-decision [listing]

  ask (max-one-of guests [who]) [
        if listing != nobody
        [ create-link-with listing [ set color grey ]
        ;; position the new node near its partner
          move-to listing
          fd 3 + (random 6)
    ]
  ]
end 

to-report find-partner
  ;; update the attractiveness of hosts based on the guest race --> attractiveness is a list of probabilities
  let w-a-1 1 - w-w-1 - w-b-1
  let b-a-1 1 - b-w-1 - b-b-1
  let a-w-1 1 - a-a-1 - a-b-1

  let w-a-2 1 - w-w-2 - w-b-2
  let b-a-2 1 - b-w-2 - b-b-2
  let a-w-2 1 - a-a-2 - a-b-2

  ;let w-pref reduce sentence (map [[a] -> [w-ratio] of hosts with [who = a]] (range 0 (host-count)))
  ;let b-pref reduce sentence (map [[a] -> [b-ratio] of hosts with [who = a]] (range 0 (host-count)))
  ;let a-pref reduce sentence (map [[a] -> [a-ratio] of hosts with [who = a]] (range 0 (host-count)))

  let w-pref reduce sentence (map [[a] -> [w-cnt] of hosts with [who = a]] (range 0 (host-count)))
  let b-pref reduce sentence (map [[a] -> [b-cnt] of hosts with [who = a]] (range 0 (host-count)))
  let a-pref reduce sentence (map [[a] -> [a-cnt] of hosts with [who = a]] (range 0 (host-count)))

  let temp-race ([g-race] of (max-one-of guests [who]))
  let base-ratio (map [[a b c] -> a + b + c ] w-pref b-pref a-pref)

  if temp-race = "White" [
    ;show temp-race
    ;;show base-ratio
    ;; guest-host preference: guest-host pref
    let gh-pref (sentence (n-values white-hosts [w-w-1]) (n-values black-hosts [w-b-1]) (n-values asian-hosts [w-a-1]))
    set gh-pref (map [[a] -> a * 1] gh-pref )
    ;;guest-reviewer pref
    let gr-pref (sentence (n-values white-hosts [w-w-2]) (n-values black-hosts [w-b-2]) (n-values asian-hosts [w-a-2]))
    ;;show gh-pref
    ;; add up base-ratio, gh-pref and gr-pref
    let gr-pref2 (map [[a b] -> a * b] base-ratio gr-pref)
    let att (map [[a b] -> a + b ] gh-pref gr-pref)
    ;let att (map [[a b c] -> a + b + c ] base-ratio gh-pref gr-pref)
    ;let host-order (range 0 host-count)
    set choice (random-pick-host att)
    ;set choice first rnd:weighted-one-of-list (map list host-order att) last
    ;show choice
    ;show att
    report host choice

  ]

  if temp-race = "Black" [
    ;show temp-race
    ;;show base-ratio
    ;; first preference: guest-host pref
    ;;let gh-pref (list a-w-pref a-w-pref a-w-pref a-b-pref a-b-pref a-b-pref a-a-pref a-a-pref a-a-pref)
    let gh-pref (sentence (n-values white-hosts [b-w-1]) (n-values black-hosts [b-b-1]) (n-values asian-hosts [b-a-1]))
    set gh-pref (map [[a] -> a * 1] gh-pref )
    ;;show gh-pref
    ;; secondary preference: guest-reviewer pref
    let gr-pref (sentence (n-values white-hosts [b-w-2]) (n-values black-hosts [b-b-2]) (n-values asian-hosts [b-a-2]))
    ;let gr-pref (list a-w a-w a-w a-b a-b a-b a-a a-a a-a)

    ;; add up base-ratio, gh-pref and gr-pref
    let gr-pref2 (map [[a b] -> a * b] base-ratio gr-pref)
    let att (map [[a b] -> a + b ] gh-pref gr-pref)
    ;let att (map [[a b c] -> a + b + c ] base-ratio gh-pref gr-pref)
    ;let host-order (range 0 host-count)
    set choice (random-pick-host att)
    ;set choice first rnd:weighted-one-of-list (map list host-order att) last
    ;show choice
    ;show att
    report host choice

  ]

  if temp-race = "Asian" [
    ;show temp-race
    ;;show base-ratio
    ;; first preference: guest-host pref
    ;;let gh-pref (list a-w-pref a-w-pref a-w-pref a-b-pref a-b-pref a-b-pref a-a-pref a-a-pref a-a-pref)
    let gh-pref (sentence (n-values white-hosts [a-w-1]) (n-values black-hosts [a-b-1]) (n-values asian-hosts [a-a-1]))
    set gh-pref (map [[a] -> a * 1] gh-pref )
    ;;show gh-pref
    ;; secondary preference: guest-reviewer pref
    let gr-pref (sentence (n-values white-hosts [a-w-2]) (n-values black-hosts [a-b-2]) (n-values asian-hosts [a-a-2]))
    ;;let gr-pref (list a-w a-w a-w a-b a-b a-b a-a a-a a-a)

    ;; add up base-ratio, gh-pref and gr-pref
    let gr-pref2 (map [[a b] -> a * b] base-ratio gr-pref)
    let att (map [[a b] -> a + b ] gh-pref gr-pref)
    ;let att (map [[a b c] -> a + b + c ] base-ratio gh-pref gr-pref)
    ;let host-order (range 0 host-count)
    set choice (random-pick-host att)
    ;set choice first rnd:weighted-one-of-list (map list host-order att) last
    ;show choice
    ;show att
    report host choice

  ]
end 

to-report random-pick-guest-race [tmp]
  let var (1 / sum tmp)
  let _ps map [[a] -> a * var] tmp  ;[0.1 0.2 0.1 0.4 0.1 0.01]
  let _r random-float 1
  let _lst [ "White" "Black" "Asian" ]
  let _i 0
  while [_r >= item _i _ps] [
   set _r (_r - item _i _ps)
   set _i (_i + 1) ]
  report item _i _lst
end 

to-report random-pick-host [tmp]
  let var (1 / sum tmp)
  let _ps map [[a] -> a * var] tmp  ;[0.1 0.2 0.1 0.4 0.1 0.01]
  let _r random-float 1
  let _lst (range 0 host-count)
  let _i 0
  while [_r >= item _i _ps] [
   set _r (_r - item _i _ps)
   set _i (_i + 1) ]
  report item _i _lst
end 


;;;;;;Gini coefficient

to update-lorenz-and-gini
  let sorted-wealths sort [num-guest] of hosts
  let total-wealth sum sorted-wealths
  let wealth-sum-so-far 0
  let index 0
  set gini-index-reserve 0
  set lorenz-points []
  ;; now actually plot the Lorenz curve -- along the way, we also
  ;; calculate the Gini index.
  ;; (see the Info tab for a description of the curve and measure)
  if total-wealth > 0 [
  repeat host-count [
    set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
    set lorenz-points lput ((wealth-sum-so-far / total-wealth) * 100) lorenz-points
    set index (index + 1)
    set gini-index-reserve
      gini-index-reserve +
      (index / host-count) -
      (wealth-sum-so-far / total-wealth)
    ]
  ]
end 




There are 29 versions of this model.

Uploaded by When Description Download
Chao Yu over 5 years ago updates Download this version
Chao Yu over 5 years ago model info Download this version
Chao Yu over 5 years ago updates Download this version
Chao Yu over 5 years ago updates Download this version
Chao Yu over 5 years ago revised model info Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago tst Download this version
Chao Yu over 5 years ago test Download this version
Chao Yu over 5 years ago test Download this version
Chao Yu over 5 years ago test Download this version
Chao Yu over 5 years ago Update sliders and more Download this version
Chao Yu over 5 years ago Color update Download this version
Chao Yu over 5 years ago New Download this version
Chao Yu over 5 years ago New Download this version
Chao Yu over 5 years ago new Download this version
Chao Yu over 5 years ago test Download this version
Chao Yu over 5 years ago test Download this version
Chao Yu over 5 years ago UI pdates Download this version
Chao Yu over 5 years ago Update Download this version
Chao Yu over 5 years ago ui change Download this version
Chao Yu over 5 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Homophily Choice.png preview Preview for 'Homophily Choice' over 5 years ago, by Chao Yu Download

This model does not have any ancestors.

This model does not have any descendants.