Washington state has two contradictory initiatives on the ballot this year.

Initiative 591 (I-591) would prevent background checks for gun purchases except when required by the federal government.

Initiative 594 (I-594) would ensure background checks for all gun purchases, including those conducted online and at gun shows.

Source: FiveThirtyEight

This kind of thing shouldn’t even be let onto the ballot. There should be something akin to a compiler that can weed out laws that are

  1. Contradictory to one another
  2. Contradictory to existing law

The first requirement is easy, the second requirement is harder, I mentioned it here.

Of course, Courts do serve this role, but only after laws are passed and people contest it. I think there is still room for cleaning the process up a bit and weeding out mutually contradictory laws that show up on the same ballot!

There is a promising measure on the Oregon ballot this year, Measure 90.

If Measure 90 passes, it would replace the primary election system that is currently in place. Right now, voters must register with a political party first, and then vote for candidates in that party in the primary elections. The winners for the primary for each party then go on to the general election.

One huge problem with this approach is that voters must commit to a single party for the primary election. This means that it is not possible to vote for a senator in one party and a governor in a different party. I’ve written before that I don’t think political parties are anything more than loosely organized tribal groups.

This also limits the ability for smaller parties (Independent, Green Party, Libertarian, etc.) to elect candidates, because in the primaries, voters must register with a party first. So if that person wants to vote for a few Democrats and a Green, or a few Republicans and a Libertarian, they would have to choose only one party and neglect the others. This tends to support the dominant parties, Republicans and Democrats, since they are the most numerous. There is a rational way to calculate the most effective tradeoff, but there is a better way.

Having to choose a party, and then choose a representative adds more layers between the citizen and the laws that ultimately passed. Right now, us citizens don’t vote directly on most laws, we elect representatives to do that for us. And without open primaries, we also cede even more power to the existing parties, instead, we should ignore parties and just vote for the representatives directly.

This is a great opportunity for Oregon residents to strip out an unnecessary layer of indirection from the election process, if you care about ending the Democratic/Republican-dominated primary elections, vote yes on Measure 90.

The gini coefficient is a measure of income inequality. It is calculated by ordering the given population by income, then calculating the cumulative distribution, and finding out how much it deviates from total equality.

So for example, assume there are four people, and everyone makes the exact same amount:

Then, the cumulative distribution just sums the values to the left, so for this hypothetical equal society of four, the cumulative distribution would look like this:

So, as you can see, the cumulative distribution would be a straight line. The gini coefficient is calculated as two times the area of the difference between this straight line and the actual distribution. Since in this hypothetical world, the distribution is totally equal, it follows that the gini coefficient is 0.

The way to read the gini coefficient is that 0 is totally equal, and 1 is totally unequal. In the totally unequal case, one person would make everything, and everyone else would make nothing:

As is probably obvious at this point, the gini coefficient can be any real number between 0 and 1, with lower meaning more equal, and higher meaning less equal.

However, reality is always more interesting (and messier). The real world gini coefficient in 2014 of the United States 0.42, and Switzerland is 0.31

By modeling the cumulative distribution function as a power, such as xn, you can find an n that reproduces the same gini coefficient:

In 2013, the United States had a gini coefficient of 0.42, which corresponds to a distribution curve that is about x2.45, by contrast, Switzerland has a gini coefficient of 0.31, which corresponds to a distribution curve that is about x1.9

It’s important to note that the cumulative distribution function is most likely not a simple power, but this shape does give a decent guess at what the respective distributions might look like.

Also, the gini coefficient says nothing about the absolute standard of living, meaning that a rich country and a poor country could have the same gini coefficient. For example, Norway and Czech Republic both have a gini coefficient of about 0.25, but Norway’s GDP per capita is about 5 times more than Czech Republic’s.

Given these limitations, the gini coefficient is a useful number for getting an idea about how income is distributed in a given population.

At work I have an adjustible-height desk, that way it can be both a standing or a sitting desk. In order to better understand my own usage habits, I made the desk script, which logs state transitions.

Running desk up records the time that the desk was moved up into a standing position, and desk down records the time the desk was moved into the sitting position. Later, when I have a few months of data, I’ll do some analysis and see what the probabilities are in the following state transition diagram:

The script builds a CSV file, and implements a simple interface:

desk up    # log transition to "up" state at current time
desk down  # log transition to "down" state at current time
desk log   # show last 5 state transitions along with time

Here’s the source code


function create_log_file_if_not_exists {
  if [ ! -e $log_filename ]
    echo "timestamp,state" > $log_filename

function log_new_state {

  local state=$1
  local timestamp=$(date --iso-8601=seconds)

  echo "$timestamp,$state" >> $log_filename

function show_log {

  echo "timestamp                 state"
  awk < $log_filename -F, 'NR > 1 {print $1"  "$2}' | tail -5

if [ $1 = "up" ] || [ $1 = "down" ]
  log_new_state $1
elif [ $1 = "log" ]
  echo "Invalid command: $1"
  exit 1

This will allow me to use a Markov chain to model my sitting/standing habits. More on markov chains in a later blog post.

On the health benefits (or problems) with standing, I am not a medical professional, but I think alternating sitting and standing is probably better than all sitting or all standing.