Regionalization in R

Last spring I completed a small project to write a regionalization/political districting program in R.  I never really did anything with it because it’s pretty slow.  It is very much a work in progress, however I release it to the world here:

https://drive.google.com/open?id=1jwcWlYPZLLaV6u07RHNnUfm8gDIw6bmL

The main program is called reRegionalize.R.  It calls the other code, so all of these should be unzipped into the same folder.  It works with an example data set, but it’s fairly easy to use your own.

If I start working on it again, I will post it on githuband update the link.  Use at your own risk.

A halloween injury epidemiology nightmare

A paper (‘research letter’, actually) was recently published in JAMA pediatrics  (‘Pedestrian Fatalities Associated With Halloween in the United States‘) which attempts to quantify the impact of Halloween on child pedestrian fatality risk in the United States.  I have looked at the original study, and using the numbers reported in  the study, along with a few other numbers, I have calculated the actual impact of Halloween on the risk of child pedestrian fatality in Canada.  I used Canada as a reference, but the general ideas here would be roughly the same as in the U.S..

Here is the screenshot of the results of my analysis:

And here is a link to the Google Sheet where I do all the calculations:

https://docs.google.com/spreadsheets/d/1E1OwaUp6eW5I9wcLMy9wx4ImGUI3qdJDK_P9VhJA2NM/edit?usp=sharing

The links in the document take you to the sources of data I used for these calculations.

What does it mean?

The authors of the study show that the risk of a child dying as a pedestrian as a result of a motor vehicle collision is 1.43 times higher on Halloween than on the days immediately before and after Halloween.  The main reason is probably exposure–more children walk at night on Halloween than on other days.  I don’t doubt their findings–the methods seem reasonable.

What I object to is how these results have been framed, particularly by the media.  The researchers and media focus on the measure of relative risk–that Halloween is associated with a 43% increased risk of child pedestrian fatality.  However, we need to put these results in proper perspective.  Given how rare child pedestrian fatalities are, the actual impact of this increased in risk on the population is very small.  As you can see above, in Canada, we should expect roughly 1 extra child pedestrian death every 30 years due to this Halloween effect.

Think of the children!

Some might argue that even one extra child pedestrian death is one too many.  That seems reasonable on the face of it, but it’s also naive.  Life involves making trade-offs.  While we could go out of our way to increase policing on Halloween, inform and educate parents of risks, add street lighting, and end trick or treating altogether, all of these risks come with a cost, and there’s no guarantee that any of them would even reduce the fatality risk at all.  Furthermore, there are probably more cost-effective ways of saving children’s lives–such as increasing immunization rates, particularly in the developing world.

Finally, media stories about the dangers of Halloween have an important social cost.  They add to the culture of fear, paranoia and helicopter parenting that threaten to further erode the joyful chaos of childhood.  This exceedingly small risk may be real, but is it really worth the attention it received on Halloween given the impact it may have on parental attitudes towards safety in their community?

My relative risk diatribe (again!)

This is another instance of media sources putting emphasis on relative rather than attributable risk.  In fairness, the researchers do not discuss attributable risk in their paper, and so perhaps it’s unfair to blame non-expert journalists for not figuring it out on their own.  Relative risk provides little useful context for understanding the risk of rare events.  Relative risk tells us only the difference in risk between exposed and non-exposed groups; it does not tell us about the actual impact on our lives.  A relative risk of mortality of 2.0 (where exposure increases risk of death by 100%) sounds terrifying on the face of it, but what if the baseline risk is one in a billion?  This would mean risk from exposure would go from from 0.000000001 in the unexposed to 0.000000002 in the exposed, and result in one extra death per billion people due to exposure.

In terms of relative risk, Halloween seems pretty terrifying to child pedestrians; however, relative risk does not tell us a complete picture, since pedestrian fatalities are (fortunately) rare and Halloween only happens once a year.  In terms of attributable risk and actual impact on the population’s health, the impact of Halloween on pedestrian safety is pretty small, and it’s not clear that knowing about these risks (when measured in terms of relative risk) is meaningful, particularly since there are material and social consequences to fear associated with media stories about the dangers of our world.

On rhubarb clusters

Introduction

Many, many years ago I had a friend who was very smart, and had a predilection for saying all sorts of stuff that seemed both facilitating and ridiculous.  One thing I remember him saying is that any time there is a crowd of extras in a movie that have to make background conversation, they were instructed to say the phrase ‘rhubarb cluster’.  He said that when everyone in a crowd says the phrase ‘rhubarb cluster’, it simulates a conversation, and keeps their lips moving in a way that looks realistic on film.  There are other advantages too.  He said it keeps the extras focused on doing something other than staring off into the distance in a way that could distract from the main movie scene, and it ensures that no actual words are heard or understood by the movie watcher (imagine the grief of two extras in a scene overheard saying “dude! I got so STONED this past weekend” on the audio track of a blockbuster).  In short, by instructing the extras to say a specific phrase, a director keeps control of the soundscape.

I have wondered for years if this would work in the real world, or if my friend was making it all up, but I never really followed up any further.  A few weeks ago I told my 6 year old daughter about this (almost certainly apocryphal) use of ‘rhubarb cluster’ in film, and she suggested I run an experiment using students in one of my classes to determine if it is at all plausible.  So I did.  Below, I present the methods and results.

Methods

I stood at the front of a class of about 70 students, turned on the voice recorder on my cell phone, and had them say three things.  First, I had them say the phrase ‘rhubarb cluster’ repeatedly for about 10 seconds.  Second, I had them say the alphabet repeatedly for about 10 seconds.  Finally, I had them carry on a conversation with their neighbour for about 10 seconds.

Then I cleaned up each sound sequence.  I cleaned them in two steps.  Step one was to trim out the audio after a short ‘burn in’ period.  I had to do this because for the first few seconds, the phrase  ‘rhubarb cluster’ is quite audible:

I did this for all three audio clips.  Then I normalised the volume levels for each clip to the same level.

I then combined the audio clips into a YouTube video:

 

Finally, I set up a short online survey for my students, asking them to watch the video, and then identify which of the clips was ‘rhubarb cluster’, and which was real conversation.  Based on the method of administering the survey, I could not set up a proper choice set experiment (with random order of audio clips, for example), but I am not sure that would have affected the results much.  Speaking of which…

Results

Of the 80 students that answered the survey, around 63% could correctly identify the real conversation.  By itself, that could suggest that ‘rhubarb cluster’ does not perfectly simulate audible conversation, and probably could not be used as background conversation in a film.

However, in processing the audio, I did notice something interesting about the sound levels of the three clips:

The first third of the clip is ‘rhubarb cluster’, the second is the alphabet, and the third is natural conversation.  The first section has a much more stable noise level over time than the natural conversation (the third clip), even after adjusting for different average noise level.  In other words, ‘rhubarb cluster’ yields a more predictable sound profile than natural conversation, especially after the burn in period.  For audio engineers this could be an advantage, since it would allow them to record audio at a high volume without worrying about ‘peaking’ sound levels.  Peaking sound levels results in unwanted noise and distortion on recordings, and is generally avoided in audio recording.

Conclusions

The experiment here was not perfect, but I think it’s fair to say that the results do suggest that when spoken by a small crowd (in a university lecture room) ‘rhubarb cluster’ is detectable on a digital audio recording, perhaps even to the majority of people hearing it.

Having written that, the idea of having a crowd of extras in a scene on a movie set saying some predefined phrase doesn’t seem totally ridiculous.  It would give the crowd some predictable behaviour to simulate and it could make sound recording easier.  In the experiment I conducted students could tell the difference, but perhaps a longer phrase or a longer burn in period would have made the phrase less detectable, and make the sound more natural.  Perhaps I’ll try that in next year’s class!

I’m on the YouTube!

I have a YouTube channel: Geographylectures.

If that link doesn’t work, just copy and paste this link: https://www.youtube.com/channel/UCiM9ObGzhIBcad97RUi8mBw)

Be sure to subscribe to get rapid access to all the awesome and compelling content I will upload.  This will include R, QGIS, Gimp and Inkscape tutorials, lessons on various topics that I think are useful, and other random stuff that interests me.

My goal is to get a 10,000,000 subscribers, so I can retire early and sit around in my underwear at home all day.  Help me live the dream!

Neo-Marxism and the Fermi paradox

Enrico Fermi, a Nobel prize winning physicist, probably said and did many interesting things over the course of his life, but the only thing I know about him is that he is responsible for what people now refer to as the Fermi paradox.


By Department of Energy. Office of Public Affairs [Public domain], via Wikimedia Commons

In short, the Fermi paradox says that given the vast quantity of stars in our galaxy, and the virtual certainty that many of these stars are encircled by Earth-like planets, why hasn’t earth been visited by aliens from these planets?

There are many possible answers to this paradox, all of which are pretty speculative.  A few examples:

  1. Supernaturalism (god(s), magic, etc.)
  2. We are regularly visited by aliens and don’t know it yet
  3. Alien civilizations are waiting until the universe is a bit cooler, and it is more efficient to travel great distances (the Aestivation hypothesis)
  4. Intelligent life is really, really rare

Well, I have a favourite answer to this paradox, and it’s kind of Marxist.

Before I proceed, I should say a couple of things.  First, I am not a Marxist, I don’t practice or even like Marxist scholarship, and I am not making any claims about the way the world ought to be.  This is more of a thought experiment than anything.  Finally,  I seriously doubt that I am the first to discuss this idea, so this is merely an attempt to articulate it in my own way.

Technological progress is self limiting

The basic idea here is that as any creative civilisation approaches the capability of efficient interstellar travel it simultaneously approaches the capacity to destroy itself, along with the technology for efficient interstellar travel.  This places a limit on technological advancement well below what would be required for interstellar travel.  I won’t inventory the many ways that technological progress can destroys itself. but just offer three possibilities.

  1. Interconnections are necessary for advanced technology, but cause fragility Interstellar travel will require a great degree of coordination and interconnection.  This isn’t just cooperation between people, but the interconnection of energy production, communication systems, and labour.  Basically, we’ll probably rely on single interconnected systems more and more over time because they will be necessary to reach the productive efficiency required for interstellar travel.  The problem is that such interconnection makes civilisations more fragile to the effects of disasters.  A single failure in an interconnected system has larger effects on the system as a whole than the same failure in a decentralised and unconnected system.  Think of major financial collapses; big banks are more efficient, but when they fail, watch out.
  2. Production enhancing technology makes it easier for megalomaniacs to kill  I have written before on the consequences of ever increasing productive efficiency on human survival.  Productive efficiency boils down to how much labour is required to produce a product or service.  Interstellar travel will require a great deal of productive efficiency–much more productive than we humans have now, for example.  However, the downside of increased productive efficiency is that it increases the efficiency of everything–both good and bad.  This means that as a creative alien species increases productivity, they also make it easy for an insane megalomaniac among them to destroy their world.  Think of it this way: the scale of harm that an stone age insane megalomaniac could do was pretty limited.  Today, one insane megalomaniac can do a lot of damage, and megalomaniacs of the future will have even more efficient tools for destruction.  It seems inevitable that innovation in productivity would have a self-induced limit; any alien civilisation that develops technology for interstellar travel is simultaneously creating technology that enables an insane alien megalomaniac to destroy civilisation.
  3. Production enhancing technology evolves too fast for societies to adapt      This is kind of related to the above point, but is perhaps more speculative.  The idea is that social and biological evolution (whether natural or artificial) is a slower than technological innovation, and the result is that our societies have a hard time adapting to the technology we create.  Failure to adapt can produce limits on further innovation.  For one, it can create resistance against the technology, some minor and short lived (like the 19th century protests against motor vehicles) and some major and long-term (like current opposition to nuclear power).  It can also create conflicts between societies in possession of these technologies that impairs or even reverses innovation.  Lags between social/biological evolution and technological innovation slows down and eventually halts advancements in productivity, particularly those for which the benefits to humanity are not immediately clear–as could easily be the case in interstellar travel.

Conclusion

None of these arguments assume much about the nature of aliens or how they organise themselves.  The main assumption is that increasing productive efficiency is unavoidably paired with technological innovation.  That’s why I see this as a Marxist or neo-Marxist resolution to the Fermi paradox; changes in the modes and efficiency of production drive innovation, but also create conditions for destruction, resulting in a self-induced limit on all technological innovation.

Personally, this possible limit does bother me at all, as I have never been much of a fan of aliens or space travel and exploration.