One of the things I've found useful when doing that comparison is figuring out which existential risks will actually make Earth less livable than other planets. If, say, the worst-case CO2-based climate change scenario comes to pass, Earth will still be a better place to live than Mars, and easier to terraform to human-optimal than Mars will be.
Again, when considering something like nuclear war, I believe a post-apocalyptic Earth would be better than an untouched Mars.
Against other existential risks- like UFAI- I don't think fleeing helps. There's probably one or two where it does- but even for stuff like gamma ray bursts or asteroid strikes the back of the envelope calculations I've done in the past have suggested fleeing Earth is a bad plan.
The old L5 Society would be rather disappointed with your focus on planets. Incremental construction of space habitats would be significantly easier than whole-planet terraforming, and putting the eggs in multiple baskets in multiple orbits is more survivable than any handful-of-planets scenario.
Can anyone recommend some resources, or provide actual examples, of any relevant evolutionary-biology-style equations which could describe what factors would most likely predominate to allow for the survival of sapience, given such factors as the ease which any given individual can acquire the means of killing large numbers of people, the scale of those means, the willingness o people to use those means, the ability of small groups to travel away from other groups, and so on?
Or, put another way - is there any way I can quantitatively check my intuition that a valuable way to avoid certain existential risks is to flee Earth?