Tag Archives: microsimulation

The Douglass-Truth Library Has How Unlikely a Name? A Little Simulation in Python

There are lovely libraries near my house.  Three, all in different directions.  I have spent hours in each, especially before my kids were in school.  This is a story is about the one called the Douglass-Truth Library, the surprising way it got that name, and a computer simulation inspired by that surprise.  Maybe it will surprise you, too.

Image

The Douglass-Truth Library.  Its name stands out from its peers. They have names like “Beacon Hill Library” and “Central Library”. Most Seattle libraries are named to match their neighborhoods.

Not the Douglass-Truth Library.  We just celebrated the 50th anniversary of its renaming. It was renamed in 1975 to honor the abolitionists Fredrick Douglass and Sojourner Truth.  And how were these particular leaders selected for this honor?  A community vote!

Image

Back in the early 1970s, community leaders in a neighborhood that had become predominantly African American thought their library deserved a name that reflected the community. They organized a ballot listing ten distinguished Black Americans and invited the neighborhood to vote.

The ballot clearly says “vote for one”.

How did the library get named after two?

A tie vote! Out of a ten-person race.

That is so unlikely. Is it so unlikely? How unlikely?

When I slow down to think about it, I think it must depend on how many votes there were.  One hundred voters tying does not seem likely, but it seems more likely than ten thousand voters ending in a tie.  How many ballots were cast?  I could not find any documentation of this.  But when I was at the renaming anniversary party last December, someone remembered: around 2,000 people voted.

So now can we figure out how unlikely?

Almost.  I used to love simplifying probability equations and making approximations for these sorts of formulas, and if I was writing this blog 25 years ago, it would be all about Stirling’s approximation and how with pencil and paper we could puzzle this out.  Stirling showed that tie probability scales like 1N\sqrt{\frac1N}, and that means 2,000 voters doesn’t give you 1-in-2,000 odds—it’s more like 1/45. Ties are rarer with more voters, but not vanishingly rare.

Lately, though, I’ve become more of a computer-simulation type.  Pencil and paper is fine, but random number sampling is even more fun.

(Simulation code on GitHub | Direct link to run that code in Colab)

From here, I’ll give just a sketch, so you can have fun the way you like to have fun.

Assumptions: maybe the simplest way to start is if everyone is equally liked and voters are simply choosing randomly (no strategic behaviors).  But would it be more likely to have a first-place tie if two front runners were each getting nearly 50% of the vote?

Simulation: With simplifying assumptions, I can simulate one person’s vote with np.random.choice(candidate_list, vote_probabilities), but it is faster to simulate everyone’s vote simultaneously.  Then I need to tally the votes and see if there is a tie for first place.

def simulate_election(n_votes, candidate_probs):
    votes = np.random.choice(len(candidate_probs), size=n_votes, p=candidate_probs)
    tallies = pd.Series(votes).value_counts()
    return tallies.iloc[0] == tallies.iloc[1]  # True if tie for first

Results: If all ten candidates are equally liked, there’s roughly a 1 in 20 chance of a first-place tie (with 2,000 voters). The chances drops as turnout grows—but stays above 3% even with 5,000 voters.

If there are two front runners it is more like one in 100, and if one candidate has a comfortable majority, then a tie is extremely rare. 

Image

Conclusion: The math is fun. The computer simulation is fun. But the real breakthrough happened 50 years ago when the votes came in tied and some genius invented a new option: name the library after both heroes.

Image

Leave a comment

Filed under simulation

Schelling’s Segregation Model

Thinking about this since I saw a gentrification talk at CSSS last week [editor’s note: more like a year ago]. Also thinking about engaging demo material for vivarium. Here are some recent links:
https://arxiv.org/abs/1705.03213

Click to access 1406.5215.pdf

http://nifty.stanford.edu/2014/mccown-schelling-model-segregation/
http://jasss.soc.surrey.ac.uk/15/1/6.html

Comments Off on Schelling’s Segregation Model

Filed under Uncategorized

Typology of model users

From same article as above https://onlinelibrary.wiley.com/doi/epdf/10.1002/sdr.1596

Champions

Skeptics

Mystics

Social organizational network as an important factor as well— power mapping with Spectrum of Allies exercise useful?

“[H]aving a technically sound model is not enough to assure widespread and effective use …” — additional elements, such as a champion in a leadership role and clearly defined problem to model help.

A goal that I have not yet attained: finding a keeper-of-the-model in the client organization, who can run additional scenarios.

Comments Off on Typology of model users

Filed under Uncategorized

SummerSim Papers Available

Some papers from this summer’s SummerSim (editor’s note: summer-before-last) are available online now:

Comments Off on SummerSim Papers Available

Filed under Uncategorized

Introducing Vivarium

I’ve had a new line of research developing for the last 18 months or so—*microsimulation*. It started when I stepped in to help with the “Cost Effectiveness Analysis with Microsimulation” (or CEAM) project at IHME. Now it is growing and growing to take over all of my research and recreation time. Is that bad or good?

Some of this work has now seen daylight from our presentations at SummerSim and iHEA in July, and today I am please to introduce a python package that you can use, too.

The programmers I’ve been working with on this convinced me that it is not just for cost effectiveness analysis and we need a more expansive name for it. So I present to you: vivarium. https://github.com/ihmeuw/vivarium

2 Comments

Filed under Uncategorized