Break-in data from the SPVM

Montreal Break-ins Week-by-Week
Montreal Break-ins Week-by-Week

Just today, the SPVM released some crime statistics for the island of Montreal.

CBC already did an interactive map, so I took the data set and made a histogram of break-ins by date!

It’s a PDF and you can download it and look at it RIGHT NOW. There’s also a version where it’s lumped by month, which is also instructive.

And then, I made a week-by-week animated GIF of the locations of the break-ins! (Click the image attached to this post to see.)

It’s Valentine’s Day! Time to review Bayes Theorem.

Figure 1
Figure 1

It’s Valentine’s Day! Time to review your knowledge of Bayes Theorem. Here’s a fun exercise to do: Calculate the probability that a gay man is HIV-negative, given that he tells you he’s HIV-negative.


First, let’s define our terms.

h: Does not have HIV
~h: Does have HIV
e: Says he does not have HIV
~e: Says he does have HIV


So let’s imagine that you’re a gay man, and you’re going to hook up with a guy for Valentine’s Day. You might be interested in calculating the following: P(h|e)

This expression, P(h|e) represents the probability that a gay man does not have HIV given that he says he does not have HIV.


The base rate of HIV infection among gay men who have sex with men is 19%.1

Hence: P(~h) = 0.19; or P(h) = 0.81

See Figure 1 for a graphical representation. The entire square represents all gay men who have sex with men. The blue rectangle takes up 81% of the square, which is proportional to the CDC’s best estimate for the number of gay men who are actually HIV-negative.

From the same source, we can also determine that the probability that a person says he does not have HIV given that he does have HIV to be 44%.1

Hence: P(e|~h) = 0.44

In Figure 1, this is represented by the green rectangle. Given that a person is HIV-positive, there’s a 44% that they don’t know, and so they would likely say that they are “negative.”

The remainder, the yellow rectangle, is the proportion of gay men who are HIV-positive and who know that they are HIV-positive.


I am considering only the population of gay men who have sex with men.

Built into this is the assumption that men who have HIV and don’t know it would report themselves as HIV-negative, or that there wouldn’t be anyone who just says “I don’t know.”

I am also assuming here that 100% of gay men who don’t have HIV will say that they don’t have HIV. Put another way, there is a 0% chance that someone will say he has HIV if, in fact he does not have HIV. This is a simplification, It’s possible that someone is confused about his status, but very unlikely. Hence:

P(e|h) = 1; or P(~e|h) = 0

Bayes Theorem

To calculate our desired value, P(h|e), we should use Bayes Theorem.

P(h|e) = P(h) / ( P(h) + P(e|~h) * P(~h) / P(e|h) )

P(h|e) = 0.81 / ( 0.81 + 0.44 * 0.19 / 1 )

P(h|e) = 0.81 / ( 0.81 + 0.44 * 0.19 )

P(h|e) = 0.91

To illustrate this graphically, in Figure 1, this would represent the chance of your prospective hook-up being in the blue area, given that the only thing you know about him is that he’s either in the blue area or the green area.


Your risk of HIV exposure can be informed by your prospective sexual partner’s response to whether or not he is HIV-negative.

If a person tells you that he’s HIV-positive, he knows his status. No one goes around claiming to be HIV-positive unless they’ve been tested and got a positive result. The best evidence we have indicates that HIV-positive people with an undetectable viral load do not transmit HIV.2 So with a sexual partner who’s HIV-positive, you’re not getting any surprises.

If you don’t even ask about your prospective sex partner’s HIV status, you can be 81% certain that he’s HIV-negative, just because of the base rate of HIV prevalence. If you do ask and he tells you that he’s negative, that is a useful piece of information—it allows you to update your estimation of the probability that your prospective sexual partner is HIV-negative to 91%, but there’s still about a 1 in 10 chance that he’s HIV-positive, has no idea, and is not being treated for it.

Happy Valentine’s Day everyone!


  2. Attia S et al. Sexual transmission of HIV according to viral load and antiretroviral therapy: systematic review and meta-analysis. AIDS. 23(11): 1397–1404, 2009.

It’s Movember! Review your knowledge of Bayes’ theorem before getting your PSA test.

Background info

There are 3 million in the U.S. currently living with prostate cancer. There are approximately 320 million people in the US today, roughly half of whom will have prostates. Hence, let us take the prevalence of prostate cancer among those who have prostates to be approximately 3 in 160, or just under 2%.

The false positive (type I error) rate is reported at 33% for PSA velocity screening, or as high as 75%. The false negative (type II error) rate is reported as between 10-20%. For the purpose of this analysis, let’s give the PSA test the benefit of the doubt, and attribute to it the lowest type I and type II error rates, namely 33% and 10%.

Skill testing question

If some random person with a prostate from the United States, where the prevalence of prostate cancer is 2%, receives a positive PSA test result, where that test has a false positive rate of 33% and a false negative rate of 10%, what is the chance that this person actually has prostate cancer?

Bayes’ theorem

Recall Bayes’ theorem from your undergraduate Philosophy of Science class. Let us define the hypothesis we’re interested in testing and the evidence we are considering as follows:

P(h): The prior probability that this person has cancer
P(e|¬h): The false positive (type I error) rate
P(¬e|h): The false negative (type II error) rate

P(h) = 3/160
P(e|¬h) = 0.33
P(¬e|h) = 0.10

Given these definitions, the quantity we are interested in calculating is P(h|e), the probability that the person has prostate cancer, given that he returns a positive PSA test result. We can calculate this value using the following formulation of Bayes’ theorem:

P(h|e) = P(h) / [ P(h) + ( P(e|¬h) P(¬h) ) / ( P(e|h) ) ]

From the above probabilities and the laws of probability, we can derive the following missing quantities.

P(¬h) = 1 – 3/160
P(e|h) = 0.90

These can be inserted into the formula above. The answer to the skill-testing question is that there is a 4.95% chance that the randomly selected person in question will have prostate cancer, given a positive PSA test result.

What if we know more about the person in question?

Let’s imagine that the person is not selected at random. Say that this person is a man with a prostate and he is over 60 years old.

According to Zlotta et al, the prevalence of prostate cancer rises to over 40% in men over age 60. If we redo the above calculation with this base rate, P(h) = 0.40, we find that P(h|e) rises to 64.5%.

Take-home messages

  1. Humans are very bad at intuiting probabilities. See Wikipedia for recommended reading on the Base Rate Fallacy.
  2. Having a prostate is neither a necessary nor a sufficient condition for being a man. Just FYI.
  3. Don’t get tested for prostate cancer unless you’re in a higher-risk group, because the base rate of prostate cancer is so low in the general population that if you get a positive result, it’s likely to be a false positive.

The answer to the question

On October 9, inspired by the STREAM research group’s Forecasting Project, I posed a question to the Internet: “Do you know how the election is going to turn out?” I tweeted it at news anchors, MP’s, celebrities, academics, friends and family alike.

I’m very happy with the response! I got 87 predictions, and only 11 of them were what I would consider “spam.” I took those responses and analysed them to see if there were any variables that predicted better success in forecasting the result of the election.

The take-home message is: No. Nobody saw it coming. The polls had the general proportion of the vote pretty much correct, but since polls do not reflect the distribution of voters in individual ridings, the final seat count was very surprising. This may even suggest that the Liberals got the impetus for a majority result from the fact that everyone expected they would only narrowly eke out a victory over the incumbent Tories.

You can view the final report in web format or download it as a PDF.

Aristotle’s Square of Opposition … in Lojban

Here it is: one obscure type of logic expressed in an even more obscure type of logic! You’re welcome!

xusra natfe
kampu ro da poi broda cu brode no da poi broda cu brode
steci da poi broda cu brode da poi broda cu na brode

I wasn’t sure whether to render the O categorical sentence (bottom-right) as {naku ro da poi broda cu brode} or {da poi broda cu na brode}. It has been left as an exercise for the reader to determine whether they are logically equivalent.

Can you predict the outcome of Canada’s 42nd federal election?

The STREAM (Studies of Translation, Ethics and Medicine) research group at McGill University, of which I’m a part, has been working on a project for the last year or so in which we elicit forecasts of clinical trial results from experts in their field. We want to see how well-calibrated clinical trialists are, and to see which members of a team are better or worse at predicting trial outcomes like patient accrual, safety events and efficacy measures.

Inspired by this, I borrowed some of the code we have been using to get forecasts from clinical trial investigators, and have applied it to the case of Canada’s 42nd federal election, and now I’m asking for you to do your best to predict how many seats each party will get, and who will win in your riding.

Let’s see how well we, as a group, can predict the outcome, and see if there are regional or demographic predictors for who is better or worse at predicting election results. The more people who make predictions, the better the data set I’ll have at the end, so please submit a forecast, and ask your friends!

The link for the forecasting tool is here:

Just to make it interesting: I will personally buy a beer for the forecaster who gives me the best prediction out of them all.* :)

* If you are younger than 18 years of age, you get a fancy coffee, not a beer. No purchase necessary, only one forecast per person. Forecaster must provide email with the prediction in order for me to contact him/her. In the case of a tie, one lucky beer-receiver will be chosen randomly. Having the beer together with me is conditional on the convenience of both parties (e.g. if you live in Vancouver or something, I’ll just figure out a way to buy you a beer remotely, since I’m in Montreal). You may consult any materials, sources, polls or whatever. This is a test of your prediction ability, not memory, after all. Prediction must be submitted by midnight on October 18, 2015.

Lojban logical connectives illustrated with Venn diagrams

Truth functions for Lojban logical connectives
Truth functions for Lojban logical connectives

For my own reference, I have illustrated the 14 possible truth functions that can be expressed using the A, E, O and U connectives in Lojban, and annotated them with the most appropriate forethought connective to do the job.

In many cases, there are multiple ways to express a single truth function. For example, {gonai broda gi brode} is logically equivalent to {segonai broda gi brode} and {go broda ginai brode} and {sego broda ginai brode}, but despite the fact that they are well-formed Lojban there is literally no reason to ever use those constructions, and ones like {go … ginai …} kind of defeats the purpose of using a forethought connective in the first place. Mutatis mutandis with {ga … gi …} vs {sega … gi …}, etc.

Of course, since there’s 4 regions of the Venn diagram that could be shaded or not, that makes 24=16 possible truth functions. The topmost Venn diagram is the forethought-connected question, not an attempt at the truth function where all the regions are unshaded. So what happened to the remaining two functions? It is not possible, using the regular Lojban connectives, to make a Venn diagram that would be all white or all red. Fortunately, as the CLL says, these are “pretty useless anyway.”

Come to think of it, how would I render those into English? “A or B or both or not A or B?” and “Not A and Not B and not not A or B?” Gross.

For a more legible version, see the attached PDF: Truth functions

Stephen Harper’s “soft on torture” agenda

A longstanding policy of the Conservative government has been reliance on information gathered from, and outright complicity with the torture of human beings. Since we’re deep into an election, and elections are one of the most clear ways that we’re supposed to be keeping our government accountable, let’s have a look back at the Conservative government’s “soft on torture” agenda.

As Man-in-Blue-Suit would say, let’s be clear. I’m not talking about metaphorical torture. I’m talking about purposely imposing literal pain, humiliation and deprivation on actual living human beings in order to elicit information, or to otherwise bring about some political gain. This is serious, and to call it “torture” is not an exaggeration in the slightest. And Stephen Harper has made sure that the Canada is a part of it. To sum up, as Harper said himself, we might not recognise Canada, now that he’s had his way with it.

To start with, this is not a one-off thing. This is a policy that the Cons have crafted over the course of years. Far from being an accident or an oversight, parts of this “soft on torture” policy were implemented in secret, which suggests that they understood the enormity of what they were doing, but they wanted to get away with it anyway.

Contrary to Harper’s patronising dismissals, this is not a conspiracy theory either. This is well-documented by internal government “watchdogs,” military memos, Parliamentary debate and even reports from foreign powers.

The following is not an exhaustive report, but just a convenience sample that I came up with. The earliest article is from the Globe and Mail in 2012, saying that Harper covered up the delivery of prisoners to be tortured more than 5 years prior, and the most recent is the response to the CIA report in December of last year.

Fortunately, Canada is a democracy, and one of the things that we citizens of Canada have is the right—and the responsibility—to hold the government of the day accountable for its actions at the polls.

Short story prompt for Lojban enthusiasts: la cizra mensi

Short story prompt: la cizra mensi

The hero of your short story has found a way to summon the Weird Sisters of Macbeth fame to inquire after the future. Worried that the witches will try to trick your hero by giving a prophesy that can be favourably and plausibly read one way, but that also has an alternate, surprising and terrible interpretation that is consistent with the words of the prophesy, your hero finds a way to force the witches to speak in Lojban.

Unfortunately for the hero of your story, a witch’s prophesy can backfire in unexpected ways that still respect the letter of the prophesy itself, even if it’s delivered in a language that’s syntactically unambiguous.

Macbeth 1.3

In the spirit of this short story prompt, I have rendered the first part of Macbeth, act 1 scene 3 into Lojban for your enjoyment. Corrections and suggestions welcome. :)

termafyfe’i 1: [1] .i doi lo mensi do pu zvati ma

termafyfe’i 2 .i lo jai bu’u lo nu catra lo xarju

termafyfe’i 3 .i doi lo mensi do zvati ma

termafyfe’i 1 .i lo fetspe be lo blopre pu cpana be lo galtupcra ku ralte lo narge

[5] gi’e omnomo gi’e omnomo gi’e omnomo .i lu ko dunda fi mi li’u se cusku mi .i lu ko cliva doi lo termafyfe’i li’u lo zargu citka cagna cu se krixa .i lo nakspe be lo se go’i pu klama la .alepos. gi’e bloja’a la .tirxu. .i ku’i ne’i lo julne mi lo te go’i fankla

[10] .ije mi simsa be lo ratcu poi claxu lo rebla ku co’e gi’e co’e gi’e co’e

termafyfe’i 2: .i mi dunda do pa lo brife

termafyfe’i 1 .i do xendo

termafyfe’i 3 .i mi co’e pa lo drata

termafyfe’i 1: [15] .i mi ralte ro da poi drata .i je’a lo blotcana cu bifca’e ro da poi farna be fi lo makfartci pe lo blopre ku’o zi’e poi se djuno .i mi ba simsa be lo sudysrasu bei lo ka sudga ku rincygau

[20] .i lo nu sipna ku ba canai lo donri ku .a lo nicte ku dandu za’e lo galtu dinju canko gacri .i zo’e ba dapma renvi .i ba ca lo tatpi jeftu be li so pi’i so cu jdika lo ka stali .e lo ka pacna .e lo ka gleki

[25] .i zu’u lo bloti to’e pu’i se daspo .i zu’unai lo go’i vilti’a se renro .i ko viska lo se ralte be mi

termafyfe’i 2: .i ko jarco fi mi .i ko jarco fi mi

termafyfe’i 1 .i mi nau ralte lo tamji be fi lo blosazri

[30] poi ca lo nu zdani klama ku bloti janli morsi

[.i ne’i damri]

termafyfe’i 3: .i damri .i damri .ua .i la .makbet. je’a tolcliva

ro da poi termafyfe’i: .i lo cizra mensi noi xance jgari simxu zi’e noi klama be fo lo xamsi .e lo tumla be’o sutra

[35] cu klama fi’o tadji tu’a di’e .i ciroi klama lo tu’a do .i ciroi klama lo tu’a mi .i ciroi ji’a klama .iki’ubo krefu fi li so .i ko smaji .i lo makfa cu bredi

[.i nerkla fa la .makbet. .e la bankos.]