Showing posts with label healthcare. Show all posts
Showing posts with label healthcare. Show all posts

Monday, 16 November 2015

The Risk of Relying on a Single Data Source: A Lesson from NASA's MODIS Satellites

I read a fascinating article recently on the darkening of Greenland's ice sheet. NASA has been proclaiming for years that the ice is getting darker due to increased global pollution and is therefore reflecting less sunlight back into space, something that has ramifications for global warming. However, when researcher Chris Polashenski and his team analyzed Greenland ice samples to explain this darkening, they found ... nothing. Turns out there has been no darkening of the central ice sheet after all. Polashenski's explanation is that the satellite sensors on NASA's aging MODIS satellites are degrading and NASA has failed to correct for this error. I have not found any response from NASA yet, but I may have missed it.
Source
It appears that no matter how expensive and complex the measuring tools get, nothing beats boots on the ground to verify the data.

Calibrating Sensors

When I was in university, I had the privilege of working for the Canadian government doing research in preparation for the first RADARSAT satellite. When I was there in 1991, RADARSAT was still four years in the future, but the Europeans launched ERS-1 that summer and it carried the first spaceborne Synthetic Aperture Radar (SAR) system. Because Canada had a reliable airborne SAR system, we helped the Europeans calibrate their new satellite. We did that by having the satellite and the plane pass over the same stretch of eastern Lake Superior shoreline at the same time while people on the ground took measurements of the conditions that would affect radar return, such as air and water temperature, wave heights, wind speed, and so forth. The ground measurements and airborne radar images could be compared and then the ERS-1 images could be calibrated against both of them. Once calibrated to real-world data, the satellite SAR could image any other areas of the Earth's surface and the radar image could be reliably interpreted to describe the surface conditions.

Convair-580 C/X SAR
The Convair 580 C-X SAR Aircraft that helped calibrate the ERS-1 satellite in 1991. Source

The lesson I learned from those months doing radar research is that even the most complex sensors are only useful if they are calibrated against a real-world source.

Implications for Business Intelligence

As we move into the age of the Internet of Things (IoT), this problem will only become more prevalent. If we base any important decisions on a single measurement source, we stand the risk of getting fooled by a faulty sensor. Of course, it's not just technical gizmos that can fail. Any single source of data can be faulty, including someone's spreadsheet.

When I worked in the hospital sector in the late 1990's, the government funding agency sent out a spreadsheet showing how the complexity of cardiac surgery cases had mysteriously dropped during the first 6 months of that year across all cardiac hospitals in the province. As a result, they were clawing back over a million dollars in funding based on the argument that the hospitals were taking simpler cases and were redirecting the funds elsewhere. Our hospital CEO was concerned as it is no simple exercise to find money half way through a budget year. A colleague of mine was assigned to discover if this complexity drop was real, so the first thing he did was talk to the Chief of Cardiac Surgery. Were cardiac surgery cases getting simpler? On the contrary, he answered, they were getting noticeably more complex. It was the same story when he spoke to surgeons at other hospitals. My colleague then set out to uncover the discrepancy, which he eventually found as a formula error buried deep in the spreadsheet. He corrected the spreadsheet, sent it back to the government, and a few days later they sheepishly sent out the corrected spreadsheet showing a slight increase in cardiac surgery complexity across the province. The funding clawback was quietly cancelled. It was sloppy spreadsheet work on the government's part for sure, but the approach to solving the problem began by getting a second measurement source, in this case by having a conversation with a surgeon.

It reminds me of Segal's Law, which states:

A man with a watch always knows what time it is.
A man with two watches is never sure.

Every watch has a measurement error of some degree, but you are only confronted with that error when comparing to a second watch. When looking at one watch, we can easily forget about its inherent inaccuracies. NASA was looking at one watch for a decade and it was sure it had the correct time. Even the experts can make simple mistakes.

When it comes to any important business decisions that you are basing off of your BI metrics, always make sure you have a second watch.

Source: David Boettcher. Notice how these watches differ?

Friday, 8 March 2013

Exponential Distributions, Part 2 - The Tail Wags the Dog

In Part 1, we looked at the asymmetry of exponential distributions, particularly Erlang Distributions.  We concluded that in terms of randomness, bad luck will come more frequently than good luck.  Now in Part 2, we look at the magnitude of that bad luck.  It's not just about the number of bad luck events, but how large those individual events can be and how much effect they can have on the behaviour of a system.

Exponential Attribute #2:  Outliers Cannot Be Ignored
Or, The Tail Wags the Dog


What is an outlier?

An outlier is a statistical term for an observation that is markedly different from the other observations in the dataset.  It is ultimately a subjective definition even though they are often determined using statistical formulas.  Common practice uses +/- 3 standard deviations from the mean as the boundary for outliers, which is reasonable for normal distributions.  However, there is no mathematical rule that says this boundary definition is better than any other.

So what is the purpose of identifying outliers?

The primary purpose is to exclude measurement errors or other unusual occurrences that would bias the dataset and lead one to make a wrong conclusion.  That's a worthwhile goal.  However, the opposite danger is to exclude valid measurements as outliers and that too can lead one to make a wrong conclusion.  Excluding outliers is a double-edged sword.

The chart on the right is a box plot of the Michelson-Morley Experiment results from 1887 where the speed of light was measured as the earth moved through the supposed "aether wind" of space.  There were 5 experiments with 20 observations each.  The top line of each box shows the 75th percentile value, the bottom line is the 25th percentile, the middle bold line is the median, and the T's are the maximum and minimum.  The small circles represent outliers as per the boundary definition above.  For experiment #3, four of the observations are deemed to be outliers -- two large-value outliers and two small-value outliers.  As you can see, while statistically they may be considered distant from the rest of the values in their group, three of them are within the normal "inlier" ranges of the other four experiments.

This is a good example of the difficulty and arbitrary nature of defining an outlier.  When you realize that ALL of the variation in this experiment is solely due to measurement error -- the speed of light is not changing -- then it raises the question as to why some measurement errors would be accepted as inliers and other errors would be deemed outliers.  How does one know if the two low-value outliers in experiment #3 are closer to the true value than the other 18 higher values?  As it turns out, the true speed of light is at value 792 in this chart (792 + 299,000 km/s).  That means one of the low-value outliers in Experiment #3 is just as close to being correct as the 25th percentile value.  It was a valid measurement and should not be classified as an outlier.

So even though this dataset was roughly normally distributed, it was still difficult to find the true outliers.  With exponential distributions, it gets even more difficult because of the long tail.  Simply going out 3 standard deviations from the mean does not give you a reasonable boundary for identifying outliers.

For example, using an outlier boundary of +/- 3 standard deviations on a normal distribution would define 0.27% of the events to be outliers, or 1 out of every 370 events.  That means if you were measuring the outdoor temperature once per day, you would expect to see either a high or low outlier about once per year.  If however the temperature happens to follow an Erlang distribution (with k=3, lambda=6), you would define 1.2% of the events to be outliers using the 3 standard deviation rule.  That means you would expect to see an outlier temperature once per quarter.  That's not particularly infrequent.  (Yes I know temperature doesn't follow an Erlang distribution, but humour me for a minute!)  Erlang distributions do not have the heaviest tails either -- other distributions such as the Log-normal or Weibull can have much heavier tails and therefore much greater proportions of their events beyond the 3-sigma boundary.

It's not just the number of outliers that's important to understand, but the size of each outlier as well.  The heavier the tail, the higher the outlier value can be.  In a normal distribution, the rare outlier events will still have values fairly close to the outlier boundary.  In fact, an outlier greater than +/- 6 standard deviations from the mean essentially never occurs in a normal distribution.  Not so with exponential functions.  The tails go on and on, and some outliers can have absolutely huge values.  Using our Erlang function parameters above, we would expect 0.016% of outliers to fall beyond 6 standard deviations above the mean, or 16 of every 100,000 events.  That's not frequent, but it's a far cry from never!  To use our weather analogy one last time (I promise!), that's an incredibly extreme temperature once every 17 years.  Or it's like a "storm of the century" that happens 5 or 6 times a century.

What's important to understand is that these very large and rare events are not outliers.  They are valid, real events that are an inherent characteristic of these exponential distributions.  They are not measurement errors or aberrations from what is expected.  They should not be dismissed but rather expected and planned for.

An Economist Discovers the Exponential World of Healthcare

I saw this play out in stark reality on a project a number of years ago.  I was part of a team doing data projections showing how the retiring baby boomers would affect the provincial healthcare system over 25 years.  One analysis involved predicting the demand for inpatient services.  A semi-retired and respected economics statistician on our team built a spreadsheet model for inpatient demand, crunched the numbers, and declared that inpatient days would go down over the coming decades as the baby boomers retired, and that the total inpatient costs would also drop.  The team leader was thrilled with the good news, but I was skeptical.  I had read a couple studies in peer reviewed journals that made the exact opposite conclusion, namely inpatient days would rise, average length of stay would rise, and costs would increase materially.

I asked the statistician for his model and data to review his analysis.  The data was fine and his model was sound, except for one minor step -- he ignored all of the data points above 3 standard deviations from the mean.  I asked him his reason for this omission of a significant portion of the dataset and his reply was, "Well, that's what I always do."  Obviously his entire career was spent using macro-economic data that was normally distributed, and he got into the habit of eliminating the outliers for every analysis without even thinking about it.  The problem was that one cannot do that with inpatient length-of-stay data, which follows an Erlang distribution.  This economist had used his "outlier magic wand" and made the sickest patients in the province instantly disappear!  And what do you know?  Hospital costs go down when you make the sickest patients disappear!  Unfortunately doctors and hospital administrators don't have that magic wand in their pockets and they know the sickest patients have to be treated, often at significant cost to the system.  Eliminating them from the projection made no sense.

I redid the analysis using all of the inpatient data and it agreed with the published studies, namely that inpatient days, average length-of-stay, and costs would all rise as baby boomers retired.  It took a lot of convincing of the team leader that my analysis was identical to the economist's analysis, except that I included the sick people!


When dealing with exponential distributions in the real world, remember that the tail end of the distribution drives the behaviour of the system.  Do not ignore the outliers.  They are likely real events, they will happen more frequently than you would like, they will be larger than you like, and if you ignore them you will get the wrong answer.

With exponential distributions, the tail wags the dog.

Postscript

After publishing my article this morning, I found an article by Carl Richards at Motley Fool who argues that outliers in normal distributions shouldn't be ignored either.  Seems to be the theme for the week!


Monday, 23 January 2012

Medians, Distributions, and Cancer Statistics

I found a fascinating essay archived  on cancerguide.org by evolutionary biologist Stephen Jay Gould entitled, "The Median Isn't The Message."  It's a story about how cold, stark cancer statistics became intensely personal after Gould was diagnosed with a rare form of cancer in 1982.

Having spent years myself as a data jockey in the healthcare system, including in a cancer agency, I am familiar with those cold statistics.  I had many of them memorized for easy retrieval.  Whenever I heard about an acquaintance who had been diagnosed with cancer, I would immediately determine in my head the likelihood of treatment success.  It was not the kind of information that was particularly helpful to the patient, and I quickly learned to keep that information inside my head!

Gould's cancer had a median survival of 8 months from diagnosis -- not very good odds at all.  Half of these cancer patients survived LESS than 8 months!  Being a biologist familiar with statistics, he forced himself away from the reflex conclusion that he had about 8 months to live.  The important information was the shape of the survival distribution curve, not in the median value.

As with most healthcare distributions, cancer survival is an exponential curve with a long tail to the right, meaning a few people survive much longer than the median.  The second consideration was to determine what factors classified those patients into subgroups within that distribution.  Age was one, and since Gould was relatively young, his odds at beating the median survival were better than average.

In Gould's case, a new experimental treatment turned out to separate him from the rest of the distribution and he survived for another 20 years.  When he died in 2002, it was from an apparently unrelated form of cancer.

The main point of the article is to always understand your data before you draw conclusions from it, and the best way to understand data is to look at it visually.  I always told my analysts to start with a graph of the dataset and then focus the analysis on the interesting parts.  Simply starting with averages, medians, minimums, maximums, and even fancy statistical measures like correlation coefficients will not tell you enough.

That's where Business Intelligence and Data Mining tools really make life easy.    Visualizing the data will convey much more useful information than a table of statistics.  In BI, a picture is definitely worth a thousand words!

Statistician Francis Anscombe demonstrated this principle elegantly in 1973 by creating four datasets with very different distribution shapes, but almost identical statistical properties.  They are known as Anscombe's Quartet. 

File:Anscombe's quartet 3.svg

The datasets all have the same average values for x, same average values for y, and the same variances for each.  In a normal or bell curve distribution, you can think of the variance as a measure of the width of the bell.  In a cluster of data points, variance can be understood as average minimum distance from the best-fit line running through them.  The Anscombe datasets also have the same linear regression result (i.e. the best-fit line through the data points) and the same correlation values.  Correlation is a measure of how much the x- and y-values move together.  A high positive correlation means that when x increases, so does y.

In Anscombe's Quartet, the first dataset is a textbook example of how these statistical functions are supposed to work.  The variance, regression line, and correlation are all accurate descriptions of the behaviour of this group of data points.

However, the third dataset is skewed by a single outlier.  The slope of the regression line is off, and the correlation should be a perfect 1 if the outlier is excluded.   Graphing the data makes outliers very obvious.  Sometimes outliers are measurement errors and should be excluded, but if there are many outliers it suggests there are two different datasets being displayed together.

The second dataset shows the bias of incomplete measurement.  The data is clearly curving, so a linear regression is arbitrary in that it would differ greatly if we made one more measurement, and it would differ again if we made two more measurements.  The x- and y-values are related to each other, but in a completely non-linear way.  Regression should not be considered in this case as it is meaningless.

The fourth dataset shows a completely uncorrelated, non-linear dataset with a single outlier, yet the statistical measures still generate the same results as the first dataset suggesting a high degree of correlation and linearity.  This is a stellar example of how statistical measures can be completely erroneous if used blindly.

The Anscombe Quartet highlights the frailty of some statistical measures when you leave the realm of linear or normal distributions.  Bell curves are nice, but they don't exist everywhere in the real world.  If you assume bell curves or linear relationships without verifying them first, your analytical conclusions will be way off base.