Skip to content
ImagineWorld

Non-parametric Tests

node_idnode-book_building-statistical-models-in-python_chapter-05-non-parametric-tests
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num5
chapter_titleNon-parametric Tests
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

In the previous chapter, we discussed parametric tests. Parametric tests are useful when test assumptions are met. However, there are cases where those assumptions are not met. In this chapter, we will discuss several non-parametric alternatives to the parametric tests presented in the previous chapter. We start by introducing the concept of a non-parametric test. Then, we will discuss several non-parametric tests that can be used when t-test or z-test assumptions are not met.

In this chapter, we’re going to cover the following main topics:

  • When parametric test assumptions are violated
  • The rank-sum test
  • The signed-rank test
  • The Kruskal-Wallis test
  • The chi-square test
  • Spearman’s correlation analysis
  • Chi-square power analysis

When parametric test assumptions are violated

Section titled “When parametric test assumptions are violated”

In the previous chapter, we discussed parametric tests. Parametric tests have strong statistical power but also require adherence to strong assumptions. When the assumptions are not satisfied, the test results are not valid. Fortunately, we have alternative tests that can be used when the assumptions of a parametric test are not satisfied. These tests are called non-parametric tests, meaning that they make no assumptions about the underlying distribution of the data. While non-parametric tests do not require distributional assumptions, these tests will still require the samples to be independent.

For the first non-parametric test, let’s look more deeply at the definition of a p-value. A p-value is the probability of obtaining a test statistic at least as extreme as the observed value under the assumption of the null hypothesis. Then, to calculate a p-value, we need the null distribution and an observed statistic. The p-value is the proportion of samples with a test statistic more extreme than the observed statistic. It turns out that we can construct the null distribution using permutations from data. Let’s see how to construct the null distribution using the following dataset. This dataset could represent counts of machine failures at low and high temperatures. We assume that the samples are independent:

low_temp = np.array([0, 0, 0, 0, 0, 1, 1])
high_temp = np.array([1, 2, 3, 1])

To construct the null hypothesis, we first need to decide on a statistical measure. In this case, we will look for a difference in the mean of the two distributions. So, our statistical measure will be as follows:

Now, to calculate the distribution values, calculate the statistical measure for all permutations of the dataset. Here are a couple of examples of the permutations of the dataset.

LabelObservedP1P2P3P4P5…
low010101…
low013030…
low000113…
low011020…
low001201…
low111301…
low101110…
high102012…
high230001…
high300110…
high120000…
mean difference-1.46-0.680.50.890.50.11…

Figure 5.1 – First five permutations of the observed data and the mean difference

The table shows the observed data with five randomly generated permutations of the values. We calculate the difference in the mean for each permutation. The differences in means are the values of the null distribution. Once we have the distribution, we can calculate the p-value as the proportion of values more extreme than the observed value.

Scaling of permutation calculations

In general, permutation tests can be expensive to calculate because the number of permutations grows quickly with the size of the distribution. For example, dataset sizes of 3, 5, and 7 samples correspond to permutation sizes of 6, 120, and 5,040. The dataset shown here has more than 39 million permutations! The runtime performance of a permutation test on a large dataset will likely be slow due to the number of permutations necessary to compute the null distribution.

We can perform a permutation test in Python using the permutation_test function from scipy. This function calculates the test statistic, the null distribution, and the p-value:

def statistic_function(set_one, set_two):
return np.mean(set_one) - np.mean(set_two)
random_gen=42
perm_result = sp.stats.permutation_test(
(low_temp, high_temp) ,
statistic_function, random_state=random_gen,
)

This function produces the following distribution from the dataset.

Figure 5.2 – Null distribution from the permutation test

The null distribution from the permutation test and the observed difference in the mean of the two groups is shown in Figure 5*.2*. The p-value from the permutation test is 0.036. The permutation test is the first of several non-parametric tests that will be covered in this section. Again, these types of tests are useful when the assumptions for parametric tests are not met. However, if a parametric test can be used, it should be used; non-parametric tests should not be used as default methods.

In this section, we introduced non-parametric tests with permutation tests. The permutation test is a widely applicable non-parametric test, but the computations for permutations grow quickly with the size of the dataset, which may make its use impractical in some situations. In the following sections, we will cover several other non-parametric tests that do not require computing a null distribution.

When the assumptions of the t-test are not met, the Rank-Sum test is often a good non-parametric alternative test. While the t-test can be used to test for the difference between the means of two distributions, the Rank-Sum test is used to test for the difference between the locations of two distributions. This difference in the test utility is due to the lack of parametric assumptions in the Rank-Sum test. The null hypothesis of the Rank-Sum test is that the distribution underlying the first sample is the same as the second sample. If the sample distributions appear to be similar, this allows us to use the Rank-Sum test to test for the difference in the locations of the two samples. As stated, the Rank-Sum test cannot specifically be used for testing the difference between means because it does not require assumptions about the sample distributions.

The test procedure is straightforward. The process is outlined here and an example is shown in the following table:

  1. Combine all sample values into one set and sort the samples in ascending order, keeping track of their labels.
  2. Assign ranks to all samples starting with rank 1 for the lowest sample value.
  3. Where ties occur, replace the rank of the tied values with the mean rank of the tied values.
  4. Sum the ranks for the smallest sample group, which is the test statistic.

Once the test statistic is calculated, the p-value can be calculated. The p-value can be done with a normal approximation or with an exact method. Generally, the exact method is only used when the sample size is small (less than 8 samples).

Once the statistic is calculated for the Rank-Sum test, we can determine a p-value with an exact method or with a normal approximation. We will cover the approximation method here as the exact method requires a permutation test, which will require the use of software. We approximate the p-value with a z-score (recall the z-score from Chapter 3*,* Hypothesis Testing):

where

and

In the equations here, is the number of samples in the group used to calculate, is the number of samples in the other group, is the mean of the corrected ranks, and is the standard deviation of the corrected ranks. Once is calculated, the corresponding p-value can be looked up for the z-distribution. Having described the method, let’s look at an example. The data shown in the following table can be found in the accompanying Jupyter notebook.

The following table shows this process performed on a set of data for two groups labeled with “L” and “H,” where a Rank-Sum test will be used to test for the difference in location of the two sample distributions. The test statistic for this table is 42.5, which is the sum of the corrected ranks of group L. This test statistic corresponds to an approximate p-value of 0.00194 (a two-sided test). The data for this table was downloaded from https://github.com/OpenIntroStat/openintro/raw/master/data/gpa_iq.rda.

IQGroupRankCorrected Rank
77L11
79L22
93L33
96L44
104L55
105H66
106H77
107L88
109L99
IQGroupRankCorrected Rank
111H1010.5
111L1110.5
112H1212
116H1313
118H1414
124H1515
126H1616
127H1717
128H1818.5
128H1918.5

Figure 5.3 – Corrected ranks for Rank-Sum test

We can also perform this test with software using mannwhitenyu from scipy. For the following code sample, the values corresponding to L and H from the preceding table are contained in the lower_score_iqs and higher_score_iqs variables, respectively:

0.00222925216588146
mannwhitneyu(higher_score_iqs, lower_score_iqs).pvalue

In this section, we discussed the Rank-Sum test, which is a non-parametric alternative to the t-test. The Rank-Sum test is used to test for a difference in the locations of two distributions of sample data. In the next section, we will look at a similar rank-based test, which is used to compare paired data like the paired t-test from Chapter 4*,* Parametric Tests.

The Wilcoxon Signed-Rank test is a non-parametric alternative version of the paired t-test that is used when the assumption of normality is violated. This test is robust to outliers because of the use of ranks and medians instead of means in the null and alternative hypotheses. As indicated by the name of the test, it uses the magnitudes of differences between two stages and their signs.

In research, a null hypothesis considers that the median difference between stage 1 and stage 2 is zero. Similarly, as in a paired t-test, for the alternative hypothesis, for a two-tailed test, the median difference between Stage 1 and Stage 2 is considered not to be zero, or for a one-tailed test, the median difference between Stage 1 and Stage 2 is greater (or less) than zero.

Though the normality requirement is relaxed, the test requires independence between paired observations and these observations to be from the same population. In addition, the dependent variable is required to be continuous.

To compute the test statistic, there are the following procedures:

  1. Calculate the differences in each pair between the two stages.
  2. Drop pairs with zero difference, if they exist.
  3. Take the absolute difference between each pair and rank them from smallest to largest.
  4. Calculate the signed-rank statistic by summing the ranks with a positive sign.

Let us consider the simple example that follows. We consider generic data for two stages (before and after the treatment) of nine samples.

PairBefore the treatmentAfter the treatmentAbsolute differenceSignRank
137381-1
214173-2.5
322193+2.5
41275+4
524159+5
6352510+6
7352411+7
8513813+8
9391920+9

Figure 5.4 – Demonstration of rank calculation for sign-rank test

By observing the preceding table, we can see the second and the third pairs have the same absolute difference. Therefore, their ranks are computed by averaging their original rank, (2+3)/2 = 2.5. The null and alternative hypotheses for a one-sided test are as follows:

The median difference between before and after treatment is zero

The median difference between before treatment and after treatment is positive

The signed-rank statistic is the sum of ranks for positive differences and it is given as follows:

The mean of is:

And the standard deviation of is:

Then, the test statistic is calculated by the following formula:

Referring to Chapter 3*, Hypothesis Testing*, we could use scipy.stats.norm.sf() to calculate the approximate one-sided p-value 0.012 using the.

At – level of significance – with p-value < , we reject the null hypothesis. There is strong evidence that the median before the treatment is greater than the median after the treatment. In Python, it is simple to implement the test as follows:

import scipy.stats as stats
import numpy as np
before_treatment = np.array([37, 14, 22, 12, 24, 35, 35, 51, 39])
after_treatment = np.array([38,17, 19, 7, 15, 25, 24, 38, 19])
# Signed Rank Test
stats.wilcoxon(before_treatment, after_treatment, alternative = 'greater')

The documentation for this test can be found at the following link:

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html

Another non-parametric test we will now discuss is the Kruskal-Wallis test. It is an alternative to the one-way ANOVA test when the normality assumption is not satisfied. It uses the medians instead of the means to test whether there are statistically significant differences between two or more independent groups. Let us consider a generic example of three independent groups:

group1 = [8, 13, 13, 15, 12, 10, 6, 15, 13, 9]
group2 = [16, 17, 14, 14, 15, 12, 9, 12, 11, 9]
group3 = [7, 8, 9, 9, 4, 15, 13, 9, 11, 9]

The null and alternative hypotheses are stated as follows.

The medians are equal among these three groups

The medians are not equal among these three groups

In Python, it is easy to implement by using the scipy.stats.kruskal function. The documentation can be found at the following link:

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kruskal.html

from scipy import stats
group1 = [8, 13, 13, 15, 12, 10, 6, 15, 13, 9]
group2 = [16, 17, 14, 14, 15, 12, 9, 12, 11, 9]
group3 = [7, 8, 9, 9, 4, 15, 13, 9, 11, 9]
#Kruskal-Wallis Test
stats.kruskal(group1, group2, group3)

The output of the preceding code is as follows:

KruskalResult(statistic=5.7342701722574905, pvalue=0.056861597028239855)

As – the level of significance – with p-value > , we fail to reject the null hypothesis. There is no strong evidence to show that the medians are not equal across these three groups.

Researchers are often faced with the need to test hypotheses on categorical data. The parametric tests covered in Chapter 4*, Parametric Tests*, are often not very helpful for this type of analysis. In the last chapter, we discussed using an F-test to compare sample variances. Extending that concept, we can consider the non-parametric and non-symmetric chi-square probability distribution, which is a distribution useful for comparing the means of sampling distribution variances to their population variances, specifically when the mean of a sampling distribution of sample variances is expected to equal the population variance under the null hypothesis. Because variance cannot be negative, the distribution starts at an origin of 0. Here, we can see the chi-square distribution:

Figure 5.5 – Chi-square distribution with seven degrees of freedom

The shape of the chi-square distribution does not represent an assumption that percentiles are fixed to standard deviations, as with standard normal distribution; it is expected to change with each additional sample variance calculated. When the original population data from which the sampling distribution of variances is calculated can be assumed to be normally distributed, the chi-square standardized test statistic is calculated as:

Where (n-1) is used to calculate the degrees of freedom, which are used to explain errors in sampling when building the test statistic. The critical values are based on table lookups using degrees of freedom and desired levels of significance. The null hypothesis is always, where is the observed distribution variance and is the expected variance. The alternative hypothesis for a one-tailed test is when testing the right tail and when testing the left tail. The alternative hypothesis for a two-tailed test is. This test, when the population data can be assumed to be normally distributed, is similar to the F-test in that the two variances are being compared and the result is 1 when both are the same. The difference is that the chi-square test statistic factors in the degrees of freedom and is therefore less sensitive to differences.

Understanding how this test is useful for comparing variances is helpful for understanding how the chi-square distribution also relates to frequencies of occurrences of categorical data. In the preceding chi-square statistic, we can relate the sample statistic for variance as an observed value whereas the population parameter for variance is what we expect to occur. When determining whether there is statistical significance in the occurrence of categorical factor levels, we can compare the observed occurrences to expected occurrences. We will illustrate examples for arguably the two most widely used versions of this test, the chi-square goodness-of-fit test and the chi-square test of independence, in the following sections. These tests are considered non-parametric as they do not require the assumptions stated in the first section of Chapter 4*,* Parametric Tests.

Tailedness of chi-square goodness-of-fit and independence tests

The chi-square goodness-of-fit test and chi-square test of independence in the following two sections are always right-tailed tests. The null hypothesis in these tests states a difference of zero between the observed and expected frequencies. The alternative hypothesis is that the observed and expected frequencies are not the same. The closer to 0 the test statistic, the more likely the observed and expected frequencies approximate each other.

The chi-square goodness-of-fit test compares the count of occurrences of multiple factor levels for a single variable (factor) to determine whether the levels are statistically equal. For example, a vendor offers three models of phones – three levels (brands) of the single factor (phone) – to customers, who purchase in total an average of 90 phones per week. We can say the expected frequency is 1/3 – so, 30 phones of each model are sold per week, on average. Pearson’s chi-square test statistic, which is calculated by measuring the observed frequencies against expected frequencies, is the test statistic used for the chi-square goodness-of-fit test. The linear equation for this test statistic is as follows:

, degrees of freedom = k-1

Where is the observed frequency,, is the expected frequency, and k is the number of factor levels. Using our phone example, we learn from the vendor the expected frequency of 1/3 is not actually what is observed; the vendor sells an average of 45, 30, and 15 phones of models A, B, and C, respectively. Suppose we want to know whether this observed frequency differs with statistical significance from the expected frequency. The null hypothesis is that the frequencies are equal. We formulate the Pearson’s chi-square test statistic as follows:

Suppose we want to use a hypothesis test (right-tailed) with a 0.05 level of significance, thus forming the alternative hypothesis that the observed and expected frequencies are not equal. The chi-square critical value table shows that for a level of significance of 0.05 with degrees of freedom, the critical value is 5.9915. Because 15 > 5.9915, we may conclude to reject the null hypothesis based on the critical value test.

To perform this operation in Python, we can use the statsmodels.stats.gof module’s chisquare function. Each group volume needs to be passed into a list or array, both for the observed frequencies and the expected frequencies. The statsmodels chisquare test will automatically calculate the k-1 degrees of freedom based on the counts of values in the observed (f_obs) list, but the degrees of freedom must be provided for the scipy chi2.ppf function, which provides the critical value, bypassing the need for a manual table lookup:

from statsmodels.stats.gof import chisquare
from scipy.stats import chi2
chi_square_stat, p_value = chisquare(f_obs=[45, 30, 15],
f_exp=[30, 30, 30])
chi_square_critical_value = chi2.ppf(1-.05, df=2)
print('Chi-Square Test Statistic: %.4f'%chi_square_stat)
print('Chi-Square Critical Value: %.4f'%chi_square_critical_value)
print('P-Value: %.4f'%p_value)

As noted previously, since the p-value is below the 0.05 level of significance and the test statistic is larger than the critical value, we can assume we have a reasonable amount of evidence to reject the null hypothesis and conclude we have statistical significance indicating the phone models are not purchased in equal quantities:

Chi-Square Test Statistic: 15.0000

Chi-Square Critical Value: 5.9915

P-Value: 0.0006

We could then rerun the test for two frequencies at that point, comparing 45 to 30 or 45 to 15, for example, with expected frequencies of 37.5 and 37.5 or 30 and 30, respectively, to identify which phone may be the largest influencer on sales imbalance.

Suppose we have a dataset of observed vehicle crashes in the state of Texas in 2021, Restraint Use by Injury Severity and Seat Position (https://www.txdot.gov/data-maps/crash-reports-records/motor-vehicle-crash-statistics.html), and want to know whether using a seat belt resulted in a statistically significant difference in fatalities. We have the table of observed values as follows:

RestrainedUnrestrainedTotal
Fatal1,4291,2352,664
Not Fatal1,216,93422,6631,239,597
Total1,218,36323,8981,242,261

Figure 5.6 – Chi-square test of independence “observed” table

Let us now create a table of expected values using this equation:

Where is the total in the i th row, is the total in the j th column, and is the total number of observations. This yields the following:

RestrainedUnrestrainedTotal
Fatal(2,664 *1,218,363)/1,242,261 = 2,612.75(2,664 *23,898)/1,242,261 = 51.252,664
Not Fatal(1,216,934* 1,239,597) / 1,242,261 = 1,214,324.31(1,239,597 * 23,898) / 1,242,261 = 23,846.751,239,597
Total1,218,36323,8981,242,261

Figure 5.7 – Chi-square test of independence “expected” table

The modified version of the Pearson’s chi-square test statistic we used in the goodness-of-fit test that extends to the chi-square test of independence follows:

, degrees of freedom = (r-1)(c-1)

The subscript j corresponds to columnar data and the subscript i corresponds to the row data for the observed and expected values, denoted as O and E, respectively. The values r and c in the degrees of freedom calculation correspond to the number of rows and the number of columns in the table (this is 2x2, so the degrees of freedom will equal (2-1)(2-1)=1.

Using the values from the observed and expected tables, we find the chi-square test statistic to equal the following:

The table lookup test statistic using the one degree of freedom calculated here is 3.84. We can reasonably conclude that since the test statistic of 27,942.43 is greater than the critical value of 3.84, we can conclude that in the state of Texas in 2021, there was a statistically significant difference in the rate of fatalities in vehicle crashes where safety restraints were used compared to where they were not used.

Chi-square contingency tables

The test we performed uses two 2x2 tables called contingency tables. The chi-square test of independence is frequently referred to as the chi-squared contingency test. The failure to reject the null hypothesis is contingent upon the observed table’s values matching the expected table’s values within a level of statistical confidence. However, the chi-square test of independence can be extended to tables of any combination of rows and columns. However, as the rows and columns increase in value, the tables may be less useful to interpret.

To perform this test in Python, we can use the chi2_contingency function from the scipy stats module. Inputting only the observed frequencies as a 2x2 numpy array, the chi2_contingency test provides the expected frequencies should the null hypothesis be true– the p-value, degrees of freedom used, and the chi-square test statistic:

from scipy.stats import chi2_contingency
from scipy.stats import chi2
import numpy as np
observed_frequencies = np.array([[1429, 1235], [1216934, 22663]])
chi_Square_test_statistic, p_value, degrees_of_freedom, expected_frequencies = chi2_contingency(observed_frequencies)
chi_square_critical_value = chi2.ppf(1-.05, df=degrees_of_freedom)
print('Chi-Square Test Statistic: %.4f'%chi_Square_test_statistic)
print('Chi-Square Critical Value: %.4f'%chi_square_critical_value)
print('P-Value: %.4f'%p_value)

Here, we see the chi-square test statistic is much larger than the chi-square critical value at the 0.05 level of significance and the p-value is significant at p < 0.0000. Therefore, we can conclude there is strong statistical evidence to suggest a large difference in car crash fatalities when using a safety restraint compared to not using one:

Chi-Square Test Statistic: 27915.1221

Chi-Square Critical Value: 3.8415

P-Value: 0.0000

Yates’ continuity correction

An additional argument can optionally be added to the chi2_contingency test with the correction = argument and a bool (True or False) input. This applies Yates’ continuity correction, which, per the scipy.stats documentation, adjusts each observed value by 0.5 toward the corresponding expected value. The purpose of the adjustment is to avoid incorrectly detecting the presence of statistical significance due to small expected sample sizes. Subjectively, this is useful for less than 10 samples in an expected frequency cell. However, many practitioners and researchers argue against its use.

Chi-square goodness-of-fit test power analysis

Section titled “Chi-square goodness-of-fit test power analysis”

Let’s use an example where a phone vendor sells four popular models of phones, models A, B, C, and D. We want to determine how many samples are required to produce a power of 0.8 so we can understand whether there is a statistically significant difference between the popularity of different phones so the vendor can more properly invest in phone acquisitions. In this case, the null hypothesis asserts that 25% of phones from each model were sold. In reality, 20% of phones sold were model A, 30% were model B, 19% were model C, and 31% were model D phones.

Testing different values for the nobs argument (number of observations), we find that a minimum of 224 samples produces a power just greater than 0.801. Adding more samples will only improve this. If the true distribution were more divergent from the hypothesized 25% even split, fewer samples would be required. However, since the splits are relatively close to 25%, a high volume of samples is needed:

from statsmodels.stats.power import GofChisquarePower
from statsmodels.stats.gof import chisquare_effectsize
# probs0 asserts 25% of each brand are sold
# In reality, 12% of Brand A, 25% of Brand B, 33% sold were Brand C, and 1% were Brand D.
effect_size = chisquare_effectsize(probs0=[25, 25, 25, 25], probs1=[20, 30, 19, 31], cohen=True)
alpha = 0.05
n_bins=4 # 4 brands of phones
analysis = GofChisquarePower()
result = analysis.solve_power(effect_size, nobs=224, alpha=alpha, n_bins=n_bins)
print('Sample Size Required in Sample 1: {:.3f}'.format(
result))
# Sample Size Required in Sample 1: 0.801

In Chapter 4*, Parametric Tests*, we looked at the parametric correlation coefficient, Pearson’s correlation, where the coefficient is calculated from independently sampled, continuous data. However, when we have ranked, ordinal data, such as that from a satisfaction survey, we would not want to use Pearson’s correlation as it cannot be assumed to guarantee the preservation of order. As with Pearson’s correlation coefficient, Spearman’s correlation coefficient results in a coefficient, r, that ranges from -1 to 1, with -1 being a strong inverse correlation and 1 being a strong direct correlation. Spearman’s is derived by dividing the covariance of the two variables’ ranks by the product of their standard deviations. The equation for the correlation coefficient, r, is as follows:

Where

The preceding correlation equation is safe to use under all ranking scenarios. However, when there are no ties or a minimal proportion of ties compared to the overall sample volume, the following equation may be used:

, where

However, we will perform this test in Python. Therefore, the more complex and less error-prone formula will be applied regardless since computational power enables us to bypass the manual process entirely.

Suppose we have students being judged in a competition by two judges and there is a concern that one of the judges may be biased toward some of the participants based on confounding factors, such as family ties, rather than performance alone. We decide to run a correlation analysis on the scores to test the hypothesis the two judges scored similarly for each contestant:

from scipy.stats import spearmanr
import pandas as pd
df_scores = pd.DataFrame({'Judge A':[1, 3, 5, 7, 8, 3, 9],
'Judge B':[2, 5, 3, 9, 6, 1, 7]})

We have the following table of contestants:

Student 1Student 2Student 3Student 4Student 5Student 6Student 7
Judge A1357839
Judge B2539617

Figure 5.8 – Judge rankings of student contestants for Spearman’s correlation analysis

correlation, p_value = spearmanr(df_scores['Judge A'],
df_scores['Judge B'])
print('Spearman Correlation Coefficient: %.4f'%correlation)
print('P-Value: %.4f'%p_value)

Based on the p-value of 0.04 here, which is less than a significance level of 0.05, we can say the correlation produced is significant beyond a degree of random chance. Had the p-value been greater than 0.05, we could say with a 95% level of confidence that the correlation may have been purely spurious and may not have enough statistical evidence to support determinism. Spearman’s correlation (r) is 0.7748. r_squared is therefore approximately 0.6003, meaning approximately 60.3% of the variation in the score is determined by the judge’s scoring:

Spearman Correlation Coefficient: 0.7748

P-Value: 0.0408

Since the p-value is significant and the correlation coefficient is 0.77 – and a strong correlation coefficient starts at approximately 0.7 – we may conclude that the judges’ scores are directly correlated enough to assume there is no bias in scoring present, assuming a relatively objective method for ranking exists; something more subjective may not be as suitable for correlation analysis.

In this chapter, we discussed some of the most commonly used non-parametric hypothesis tests performed when required assumptions for parametric hypothesis testing cannot be prudently guaranteed. We discussed two-sample Wilcoxon Rank-Sum – also called Mann-Whitney U – tests to draw inferences from medians when two-sample t-testing cannot be performed. Next, we walked through the Wilcoxon Sign-Rank test’s paired comparison of medians when a paired t-test comparison of means cannot be performed. After, we looked at the non-parametric chi-square goodness-of-fit test and the chi-square Test of independence for comparing observed frequencies against expected frequencies, both useful for identifying the presence of statistically significant differences in counts of categorical data. Additionally, we discussed the Kruskal-Wallis test, a non-parametric alternative to the analysis of variance (ANOVA). Finally, we discussed Spearman’s correlation coefficient and how to derive correlation based on rank when parametric assumptions cannot safely support using Pearson’s correlation. Closing out the chapter, we provided an example of using power analysis for the chi-square test.

In the next chapter, we will begin our discussion of predictive analytics, starting with simple linear regression. There, we will discuss methods for fitting a model, interpreting linear coefficients, understanding the required assumptions of linear regression, assessing model performance, and considering modified versions of linear regression.