Monday, July 19, 2021

Vaccination Fraction and the Base Rate Fallacy

I keep seeing references to the fraction of people with COVID related conditions that have been vaccinated. A recent story implied that the fact that about half of the infections in Israel were in vaccinated people was evidence that the vaccines aren't working. There is a nice post that looks at the stories about Israel. Half sounds like a lot only is you don't take into account the base rate of vaccination. Since 85% of the people have been vaccinated the fact that a far smaller fraction of the infected were vaccinated shows that the vaccines do work. Not taking the base rate into account, or deceptively not including it in the information provided, is the Base Rate Fallacy.

What is the relationship between vaccine efficacy, vaccination rate, and the fraction of those effected that are vaccinated? It turns out that it isn't as simple as you might expect.

Say the fraction of people that are vaccinated is v, and the fraction of illnesses the vaccine prevent is e. Then fraction of infected people that are vaccinated is:

Let's look at some examples. If we set both e and v at 0.85, meaning that 85% of the population has been vaccinated and that the vaccine is 85% effective in preventing disease. In that case the fraction of the cases that are vaccinated is expected to be just under half. For the current situation in the US let's take e=98% and v=30%. This gives us 0.008, which is a pretty good match for the oft repeated "99% of those hospitalized for COVID in the US have not been vaccinated".

I see a slight danger here. If we consider e=0.98 and v=0.5 we get 0.019. The vaccinated fraction more than doubles. The reason it goes up as the vaccination rate goes up is obvious, once it is pointed out. Take the extreme case, where everyone is vaccinated, v=1. Then the fraction of effected people that were vaccinated is also 100% since that's the only kind of people there are. This is the extreme case of the Base Rate Fallacy. I both hope and fear that when the US gets to v=0.5 we hear people using this doubling in the vaccinated fraction as evidence that vaccines aren't working. I hope for this because it will mean that v has gotten to 0.5 and I fear it will reduce future vaccinations. If we ever get to v=0.95 the fraction will be greater than 1/4, which will doubtless be trumpeted as a failure.

How do we get this equation?

Let's define some factors. Let's say that if G (for group) unvaccinated people are exposed we get Gc infections. That defines the degree of contagion c. If G vaccinated people are exposed there will be Gc(1-e) infections where e is the efficacy of the vaccine so we have a modified contagion factor of c(1-e).

If we have a group of N people then the number of cases expected in the vaccinated group, Cv, is Nv (the number of vaccinated people) times the modified contagion factor c(1-e).

The number cases in the unvaccinated group, Cu is N(1-v) (the number of unvaccinated people) times the contagion factor c.

So the fraction of cases that are vaccinated is the number of cases in vaccinated people divided by the total number of cases Cv/(Cu+Cv) or

There is a common factor of Nc so that cancels. So the number of people and the contagion factor don't enter into the final result. So we get: 


We could also divide through by (1-e) and get the expression at the top.

Friday, July 2, 2021

The Analemma

Most of us have seen an analemma though many are not familiar with the term. If you've looked at a globe or world map you've probably seen a curve that looks like a figure-8 somewhere in the Pacific Ocean. Like this (source: Wikimedia Commons):


The analemma is the path in the sky the sun follows at the same local time every day over the course of a year. This is the subject of some beautiful images. This one is tilted because the image shows the location of the Sun in the morning, not noon as will be used in the rest of this post.



If you haven't thought about it, it is hard to connect that statement with that shape. In fact, even if you have thought about it, it isn't easy. So what's going on here?

There are LOTS of explanations of this on the web that range from simplistic to opaque. They treat the subject with varying degrees of completeness and comprehensibility. I looked a lot of them and didn't find a single one that explained the features in a way that's comprehensive, correct, and accessible. So I decided to write this one.

Some things are easy to see. The Earth has a tilted axis that remains fairly fixed in orientation as it goes around the Sun. Except for areas near the equator, that means the Sun is higher in the sky in local summer than in the winter. For a lot of this discussion we'll be talking about the subsolar point, the spot on the Earth where the sun is directly overhead. This point is at its most northward at the June solstice and most southward at the December solstice. Each of those latitudes is removed from the equator by the tilt of the axis. The full range of this is just twice the tilt of the axis.

That explains most of what's going on but you might think that the sun would just move up and down in a straight line. There are three reasons that this isn't the case. None are obvious without a fair amount of thought and only one is explained well, or even at all, in most treatments of the analemma.

First we need to talk about one of my favorite bits of pedantry. When asked what the length of a day is on Earth most people have no problem coming up with 24 hours. And that's right, or almost right. The problem is that there at least three kinds of days. For most planets, including Earth, the day is determined mostly by the rate at which it rotates. In fact, when you look up the length of the day for any planet other than Earth what you often find is the rotation period measured with respect to the distant stars. This is called the sidereal day and for Earth this is 23 hours 56 minutes 4.09 seconds (approximately). So why do we say that a day is 24 hours? Are we just rounding up? No, that's not what's happening. There is a kind of day that is 24 hours, or pretty darn close. But we aren't there yet.

When people think of the word "day" they think about the time the Sun is above the horizon. At first blush you might think that the length of time it takes for the sun to go all around the sky is one sidereal day. But it isn't. That's because as the Earth turns it also goes around the Sun. Since both of these rotations are in the same direction it takes a bit longer for the subsolar point to return to (near) the same spot than one sidereal day. To make this clear, look at this. (source: Wikimedia Commons):


Marked "1" we see our Blue Marble with a marker pointed to the Sun. Next, at "2", Earth has rotated exactly once so it is pointing in the same direction as before but it has moved a bit around the Sun so it isn't pointed at the Sun. At position "3" it has rotated a bit more and it now pointed at the Sun. This take about four minutes. The time from noon to noon is called a Solar Day. Over the course of an entire year the number of sidereal days is one more than the number of solar days. (This figure is not an accurate representation of the motion of the Earth. The effect and relative sizes are distorted for clarity). So for a planet with a perfectly circular orbit and no axial tilt the Sun would trace the same path in the sky and be at the same point at noon every day.

But the Earth doesn't go around the Sun at a constant rate. It moves faster when closer to the Sun so it takes more time than usual to point back toward the Sun. This effect adds about 10 seconds to the length of a Solar Day in January and shortens it by about the same in June. This means that on some days it takes longer for the Sun to return to the same point in the sky, on others it takes less time. This produces side to side motion as seen in the analemma.

To see this explicitly, let's consider the point where the prime meridian and the equator cross. This is shown by the red pole pointing straight at the camera in the image below. The axis is the thick green pole and there are rings for the equator and the prime meridian.


If we look at the "Earth" (in quotes because there is no axial tilt) from the Sun once every average solar day we see two effects. The "Earth" changes size because the distance changes and it appears to rotate slightly. The spot where the Sun is overhead (subsolar) is indicated by a white dot.


It is easy to see some of the effect of a tilted axis. Let's consider the simplest case: A perfectly circular orbit with an axial tilt of 23.4°. Here are four images showing the situation at the equinoxes and the solstices.


We see that the Sun is overhead in the southern hemisphere in the first image, then at the equator, the northern hemisphere, and the equator again. So, we have the location of the Sun in the sky at successive mean Solar days moving north to south because of the Earth's tilt and east to west because of the elliptical orbit. This is where most explanations of the analemma stop. But it turns out that there are other effects. Even if our orbit were perfectly circular, the Sun's location at solar noon would still move east to west. This shift is also due to the Earth's tilt.

Let's look at a simple, but very exaggerated, situation. A planet with no axial tilt, a perfectly circular orbit, and a sidereal day 1/8 of its year. To start, as we did before, let's look from the direction of the Sun at local noon at the point with the red pole. 


Now let's move ahead one sidereal day. The axis is pointing in the same direction it was in the first image but the angle has changed.



If we advance forward to one solar day from the starting point it looks exactly like the first image. This gives the expected behavior. As we go through the year after each solar day that Sun returns to the same point in the sky.

But things are different when there is an axial tilt. Here's a set of images that show the differences. The ones on the left are the same those above. The ones on the right show what happens with a tilt of 45°. Starting at the time of the southern summer solstice so the planet has the southern hemisphere tilted the maximum amount toward the sun.

     Zero tilt                                           45 Degree tilt

The first four images are just we expect. For the top two the subsolar point is on the meridian and at a latitude that equals the axial tilt. The next two show the result of having revolved 1/3 of the way around the sun just as the planet has completed one solar rotation. But the last images are a surprise. At first we might expect the subsolar point to be along the marked line of longitude in both but isn't. The key to understanding this is to look at the axis. The North Pole has moved to the right and the subsolar point is displaced to the right of the meridian. If we look at the animation below showing an entire year of this, we see that the pole appears to shift both left and right as well as north and south.


If we look from this planet, along the direction of the red pole in the animation above we would see the Sun trace out the pattern seen below:


This computation was done with a circular orbit, all of the motion is caused by the large, 45°, tilt. If we try using the values for Earth, a tilt of 23.4° and an eccentricity (a measure of the non-circularity of the orbit) of 0.0167 we get this:


This is not the shape of the analemma as seen from Earth. It's pretty close, but not quite right. So, what went wrong? There is one more factor that affects the shape. We have taken into account the tilt of the axis producing motions in both the vertical and horizontal directions and the eccentricity of the orbit producing its own side to side motion. What we are missing is the relationship between the date of perihelion and the date of the solstice. For Earth, the southern solstice happens about 2 weeks before perihelion. In the computation above they happened on the same date. If we make this adjustment we get a good match:


This can produce some very different shapes. If we leave the date difference at 2 weeks, and increase the eccentricity to 0.3 and the tilt to 45° we get:


We can notice both the strange shape and the effects of the large eccentricity making the Sun change size by quite a bit.

I'll end this with one more simulation. Here is what the analemma looks like on Mars: