Monitoring effectiveness of diabetic treatment using Contol charts
By: Rohit Tolawat
Tags: Qq Plot, Control Chart, Hypothesis Testing, Central Limit Theorem, T Test

If you’ve ever taken a statistics class at a graduate-level program, most probably your instructor would have begun the course with the Central Limit Theorem (CLT). Before we get started, a refresher on CLT:

Regardless of the distribution of the population, the sampling distribution of sample means is normal, provided that the samples are randomly picked with replacement and the sample size is sufficiently large (n≥30).

In case, the population is normally distributed, the sampling distribution of the sample means is normally distributed even for lower sample sizes.

As we increase our sample size, the mean of the sampling distribution approaches the true mean (mean of the population).

The standard deviation of the sampling distribution of the sample mean is inversely proportional to the sample size i.e. as the sample size increases, the standard deviation of the sampling distribution reduces.

Well, this was textbookish. To help better understand, let’s pick up a dataset from Kaggle, try and replicate the results. We are choosing a dataset of diabetic patients and assuming the following:

a. The dataset chosen is the population.

b. We are only concerned about the number of days a diabetic patient spends in the hospital. All the other fields/features/characteristics in the dataset are irrelevant for this article.

c. Hospitalization details of all the patients cannot be obtained in reality.

Without further adieu, let’s get started!

The distribution of the population is as below:

Right skewed, implying that fewer patients spend a lot of days in the hospital(s)

The mean of the population is 4.4days and the Standard Deviation is 2.99 days.

In reality, one might never be able to capture the population data. Even if one could, would it be cost-effective?

When that seems to be the case, how does one estimate measures of central tendency (such as the mean) or of spread (such as standard deviation)? This is where Central Limit Theorem comes in handy. Before we implement our project, we are going to confirm our understanding of the CLT point-by-point.

Point 1: Normal distribution

We are going to randomly capture 1000 samples from the population with sample sizes n = 2,10,20, 40 each. The histogram of the sample means across the different sample sizes is as below:

As the sample size increases from 2 to 40, the sample mean exhibits a normal distribution

One could notice that in each case, the mean (solid red line) is close to 4.4 days (population mean) across the samples of different sizes. What changes as we increase the sample size, is the distribution of the sample means. As visually evident from the histogram, the distribution when n = 40, is normal. Another graphical method of checking for normality is the Quanlite-Quantile Plot or Q-Q Plot.

The Q-Q plot for 1000 samples drawn when n = 40 is:

Points lying on the straight line indicate the distribution is normal

Point 2: Estimate mean tends to the population mean

Now that we know that the sampling distribution of the sample mean is normal, let’s check on how the estimated mean performs when compared to the population:

The dashed red line is the population mean, which in reality might not be known

Point 3: Standard deviation is inversely proportional to sample size

As per CLT, the standard deviation reduces with an increase in sample size, let us check on that:

The spread of the distribution reduces with an increase in the sample size

According to CLT:

Source: Wikipedia

From the above equation, 2.99 / Sqrt(40) = 0.47 and this is in line with the results we have obtained.

Ok, Agreed! All of us knew that before, what can we do with this information.

Application of the information from Central Limit Theorem:

For starters, if the population distribution were to be normally distributed, one could use a cumulative probability distribution plot as below:

From the plot above, it could also be inferred almost 100% of the patients need hospitalization for less than 12.5 days.

However, we know that the population is not normally distributed. So, what else we got? Well, we can monitor the average number of days a patient spends hospitalized to maintain the quality of the treatment. What? How?

Control Charts

Control charts are an effective visual tool for monitoring the required metric for consistent performance. In our case, the average number of days spent by the patient hospitalized is an indirect measure of the effectiveness of the treatment. The way we will build and use them is by setting up a null and an alternate hypothesis.

Imagine that you are a medical administrator and the task at hand is to ensure that the average time of hospitalization remains at the existing duration or reduces (which would be ideal). In either case of hospitalization days being greater or less than 4.4 days, we must be vigilant. Efforts must be made to either rectify inefficiencies or sustain efforts. Control charts can help you monitor the same. Below is how you build them:

Take random subgroup samples (patients in our case). We are choosing a sample size of 10 and taking 40 samples for our study (from the population, in this case). We would then be calculating the mean and standard deviation, plotting the same with control limits. Control limits could either be set by the process or be specified by the customer or industry. In our case, we would be using the process control limits. The mean and standard deviation are plotted against the subgroup number to check if there is any pattern or a number of points going beyond the control limits.

The plot is checked for irregularities such as trends, high variance and points beyond control limits

For a very consistent and stable process, the subgroup means lie within the 1st standard deviation

Very few points are beyond the control limits, it doesn’t hurt to perform a t-test

While the subgroup sample means obtained do show variation, but there does not seem to be any trend. Also, 2 out of 40 samples have means beyond specified control limits. It makes sense for us to check if the mean obtained from this process is statistically significant to investigate further.

Performing a t-test for statistical significance

We can perform a one-sample two-tailed t-test where t-statistic is obtained as below:

The value of the t-statistic is -0.48122

The p-value of 0.3165 shows that the mean obtained is not statistically significant at 5% significance level

From the results above, we fail to reject the null hypothesis and conclude that the treatment of diabetic patients is as effective as earlier.

Summary:

We experienced the central limit theorem using a dataset that captures the number of days a diabetic patient stays hospitalized. Developed control chart to monitor if the average number of days remains the same using a control chart. Performed a t-test to check if the results obtained are statistically significant indicating the effectiveness of the treatment.

Source code for the project can be accessed using the link below:

https://github.com/rohitTheSupplyChainGuy/The-one-with-the-master-stroke-theorem