Using Data to Analyze Pfizer
Pfizer: A Basic Effectiveness Analysis
Background & Research Goal
Covid hit everyone hard, and a big part of getting through this is the vaccines that the medical community has developed along the way. Now that Pfizer has recently gained full approval by the FDA, I decided to do my own analysis on its' effectiveness. In this text we will analyze Pfizer using data.
The goal is to see how the rates of positive covid tests, covid hospitalizations, and covid deaths out of people tested relate to the when the Pfizer vaccine gained emergency approval, determining if the vaccine did, in fact, lower these rates.
I'll e doing the same for the full approval of the vaccine, seeing if the ability to impose mandates, allow private businesses to require it, etc also helped lower these rates. We’ll be looking at data collected in NYC about the results of administered covid tests. These results come from January 1st 2020 to September 27th, 2021.
Notes About the Dataset
The dataset contains 5 main points of information
- The date the tests were performed
- The number of tests performed on that date
- Amount of confirmed covid cases from those tests
- The number of covid hospitalizations
- The number of covid deaths
Well, there was one other piece of information included. It was the extraction date. This was the date that the record was added to the database. This doesn't affect the analysis on it's' own, but the fact that it was included will be important to remember for later. This wasn't the only thing I found odd about the dataset at first either. There thousands of rows for dates that hadn't happened yet. All of them displayed zero covid tests of course, and simply filtered them out. Regardless, we should discuss the rest of these points in a bit more detail.
The date of hospitalizations, deaths, and confirmed cases are not determined by when the specimen received a positive result, was hospitalized , or died. It is based off the date of specimen collection. In addition, if a specimen tests positive, and is then later hospitalized, it will count as both a positive test and a hospitalization. This means someone that tests positive for covid-19 and is then hospitalized at a later date will count as both a confirmed case and hospitalization for the date they received the test on. The same is true for deaths.
The number of hospitalizations refers to the number of people who were hospitalized and had covid-19, not necessarily the number of people who were hospitalized because of covid-19 The same is true of death rate. There is no way, within this dataset, to determine how common these occurrences might be. While the number is very likely small, it may cause the final numbers to be slightly inflated. Also, please keep in mind that the proportion of confirmed cases to unconfirmed cases is only among the people who were tested.
On a Statistical Note
I will only be including days with over 10,000 tests administered in my analysis. I'll be looking at mean rates of covid occurrence, hospitalizations, and deaths over different time periods, so having a few days with low numbers of tests could cause the mean rates to be skewed simply due to random chance, and could make independence t-tests less reliable.
When I first decided to set a lower limit for the number of tests that were acceptable, something seemed off. It looked as though even during the height of the pandemic, getting days with more than 100 tests was much rarer than I expected it to be. I knew that couldn't actually be the case, this was New York City right in the middle of covid, I was doing something wrong with the dataset.
Remember how I mentioned the extraction date earlier? That's the date the records were added to the dataset. Remembering that this column existed, I had an idea about what might be wrong, and decided to look at only one day in the entire dataset. Sure enough, when I looked at the data from a single date, what I initially expected to be a single row, came out as over 30 rows. All of them had the same specimen date, and different extraction dates. It turned out, the database wasn't being updated in the way I thought it was.
Since it had dates for days that had yet to occur, I assumed that whenever new data became available, they went into the dataset and altered the data for that day directly. In actuality, they just took one of the empty rows, adjusted the extraction date to the current date, and added more data for whatever date they received information on. At least, that's what it looks like is being done.
With that in mind, I aggregated all of the testing results by specimen date, and suddenly finding days with over 10,000 tests became easy. I experimented with a few different lower limits, but 10,000 seemed to include the vast majority of days while giving me a very high confidence that random chance in testing would be a non-issue.
So, what does that data actually tell us? Let's take a look.
The first vertical line indicates the date of Pfizer’s emergency approval (12/11/2020).
The second vertical line refers to the date of Pfizer’s full approval (8/23/2021).
It's a bit unclear just by looking at the graph if the rates are really different from each other in each of these time periods. Fortunately, eyeballing a graph is far from our only tool of making observations, so we'll jump straight into hypothesis testing.
How I’m Testing the Effectiveness
In order to determine if the Pfizer vaccine lowered the rates of contracting covid, and if its’ full approval helped to lower the rates further, I will be performing hypothesis tests on the mean occurrence, hospitalization, and death rates before the vaccine gained emergency approval, after if gained full approval, and the time in between. In short, after finding the daily rates, the hypothesis test will produce a p-value, a measure of the odds that the means are different due to chance.
If the number is below our goal p-value, that means we can conclude that the results are not simply due to chance. The target p-value here is 0.05, which is essentially saying that we are willing to accept that the difference in rates is statistically significant if there is less than a 5% chance that the differences are simply due to randomness. I considered a p-value of 0.01 (or a 1% chance target), but I decided that since this is a very basic analysis, it wouldn't be required.
Aliases for Time Periods (for convenience)
The time before the pfizer vaccine received emergency approval will be called period 1. The time between receiving emergency approval and full approval will be called period 2. The time after receiving full approval will be called period 3.
Did the Pfizer Vaccine Reduce the Rate of Confirmed Cases?
Confirmed cases ratio:
Period 1 mean; 15.6 %
Period 2 mean; 8.64 %
Mean of period 3; 4.13 %
Period 1 =/= period 2: P-value = 2.48 x 10^-9
Period 2 =/= period 3: P-value = 9.22 x 10^-6
With both p-values below 0.05, we can conclude that Pfizer’s emergency approval and full approval led to a statistically significant decrease in the rate of confirmed cases.
Did the Pfizer Vaccine Reduce the Rate of Hospitalizations?
Period 1 mean; 3.55 %
Period 2 mean; 0.86 %
Mean of period 3; 0.26 %
Period 1 =/= period 2: p-value=2.89 x 10^-11
Period 2 =/= period 3: p-value=1.31 x 10^-7
With both p-values below 0.05, we can conclude that the emergency approval of the Pfizer vaccine and its’ full approval lowered the hospitalization rate of covid.
Did the Pfizer Vaccine Reduce the Rate of Deaths?
Period 1 mean; 1.16 %
Period 2 mean; 0.15 %
Mean of period 3; 0.01 %
Period 1 != period 2: p-value=1.10 x 10^-11
Period 2 != period 3: p-value=2.86 x 10^-7
With both p-values below 0.05, we can conclude that the Pfizer’s emergency and full approval both led to decreases in the covid-19 death rate
As you may have noticed, the highest rates of covid occurrence, hospitalization and death ratios, were recorded in the earliest portion of the dataset. We could separate this from period 1 to determine what the mean ratios of period 1 would be after cases had started to fall off due to other factors, and conduct tests with that mean of ratios.
Period 3 is a particularly small length of time, partially because not much time has elapsed since Pfizer’s full approval (this analysis is being conducted in mid-october of 2021). This could lead to abnormal ratios for this period of time. Luckily, this dataset is updated daily, so I can come back to this in the future and perform the analysis again wit more data for period 3.
This study doesn’t account for is major events that are unrelated to the phizer vaccine such as quarantine, mask mandates going into (or coming out of) effect, and even the release of different vaccines. A future analysis could incorporate other large events into the analysis.
Due to the nature of vaccines, confirmed cases, deaths, etc tend to be lagging indicators of the effectiveness. A future analysis could determine how to more accurately represent this in both the analysis and hypothesis testing.
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.