Article Text

Download PDFPDF

Homoscedasticity: an overlooked critical assumption for linear regression
  1. Kun Yang1,
  2. Justin Tu2 and
  3. Tian Chen3
  1. 1 Department of Family Medicine and Public Health, University of California System, San Diego, California, USA
  2. 2 PGY-2, Physical Medicine and Rehabilitation, University of Virginia Health System, Charlottesville, Virginia, USA
  3. 3 Department of Mathematics and Statistics, University of Toledo, Toledo, Ohio, USA
  1. Correspondence to Dr Tian Chen, Department of Mathematics and Statistics, University of Toledo, Toledo, OH 43606, USA; tian.chen{at}utoledo.edu

Abstract

Linear regression is widely used in biomedical and psychosocial research. A critical assumption that is often overlooked is homoscedasticity. Unlike normality, the other assumption on data distribution, homoscedasticity is often taken for granted when fitting linear regression models. However, contrary to popular belief, this assumption actually has a bigger impact on validity of linear regression results than normality. In this report, we use Monte Carlo simulation studies to investigate and compare their effects on validity of inference.

  • Analysis of Variance
  • F-test
  • Normal Distribution
  • t-test

This is an open access article distributed in accordance with the Creative Commons Attribution Non Commercial (CC BY-NC 4.0) license, which permits others to distribute, remix, adapt, build upon this work non-commercially, and license their derivative works on different terms, provided the original work is properly cited, appropriate credit is given, any changes made indicated, and the use is non-commercial. See: http://creativecommons.org/licenses/by-nc/4.0/.

Statistics from Altmetric.com

Request Permissions

If you wish to reuse any or all of this article please use the link below which will take you to the Copyright Clearance Center’s RightsLink service. You will be able to get a quick price and instant permission to reuse the content in many different ways.

Introduction

Linear regression (LR) is arguably the most popular statistical model used to facilitate biomedical and psychosocial research. LR can be used to examine relationships between continuous variables, and associations between a continuous and a categorical variable. For example, by using one binary independent variable, LR can be used to compare the means between two groups, akin to the two independent samples t-test. If we have a multilevel categorical independent variable, LR yields the analysis of variance (ANOVA) model. Although the t-test for unequal group variance is often used as an alternative for comparing group means when large differences in group variances emerge, the same homoscedasticity assumption underlying ANOVA is often taken for granted when this classic model is applied for comparing more than two groups. For ANOVA, much of the focus is centred on normality, with little attention paid to homoscedasticity.

Contrary to popular belief, the homoscedasticity assumption actually plays a more critical role than normality on validity of ANOVA. This is because the F-test, testing for overall differences in group means across all the groups (omnibus test), is more sensitive to heteroscedasticity than normality. Thus, even when data are perfectly normal, F-test will generally yield incorrect results, if large group variances exist. Although the Kruskal-Wallis (KW) test is applied when homoscedasticity is deemed suspicious,1 this test is less powerful than the F-test, since it discretises original data using ranks, a sequence of natural numbers such as 1, 2 and 3 to represent ordinal differences in the original continuous outcomes. An even more serious problem with the KW test is its extremely complex distribution of the test statistic and consequently limited applications in practice.2

Over the past 30 years, many new statistical methods have been developed to address the aforementioned limitations of the classic LR and associated alternatives. Such new models apply to cross-sectional and longitudinal data, the latter being the hallmark of modern clinical research. Semiparameter statistical models are the most popular, since they require one of the distribution assumptions and apply to continuous outcomes without changing the continuous scale.3 In this report, we use the Monte Carlo simulation study to investigate and compare results when one of the two assumptions is violated, and to show the importance of homoscedasticity for valid inference for LR. We will discuss and perform head-to-head comparison of power between the classic KW test and modern semiparametric models in a future article.

LR model

We start with a brief overview of the classic LR. Consider a continuous outcome of interest, Y , and a set of p independent variables, Embedded Image . We are interested in modelling the relationship of Y with the independent variables. Given a sample of n subjects, the classic LR models this relationship as:

Embedded Image (1)

where i indexes the subjects, Embedded Image are the regression coefficients (parameters), Embedded Image is the error term, Embedded Image denotes the normal distribution with mean μ and variance Embedded Image . The LR in equation (1) posits a linear association between the outcome (dependent variable) Y and each of the independent variables. The latter have been called different names such as predictors, covariates and explanatory variables.

The first part of LR,

Embedded Image (2)

is called the conditional (population) mean of Embedded Image given the independent variables Embedded Image . On estimating the regression coefficients, this conditional mean can be calculated to provide an estimate of Embedded Image for each subject. In addition to the assumed linear relationship, there are two additional assumptions in equation (1): (A) normal distribution and (B) homoscedasticity, or constant variance Embedded Image for all subjects.

All three assumptions play an important role in obtaining valid inference for regression coefficients. For example, if the association of Y with a particular independent variable Embedded Image is quadratic, the linear model in equation (1) must also include Embedded Image , since otherwise estimates of Embedded Image will generally be biased. Likewise, if the error term Embedded Image is not normally distributed, SEs of estimated coefficients may be incorrect. Both the linearity and normality have been receiving great coverage in the literature.

In contrast, the impact of homoscedasticity on statistical inference of regression coefficients has received much less attention. Most publications in the biomedical and psychosocial literature do not even acknowledge this assumption for their applications of LR. Contrary to popular belief, inference about regression coefficients is actually more sensitive to departures from homoscedasticity than normality. In fact, normality actually does not matter at all when sample size is relatively large. In contrast, homoscedasticity remains an issue regardless of how large the sample size becomes. Below we illustrate these facts using Monte Carlo (MC) simulated data. For ease of exposition, we focus on one-way ANOVA, but the same conclusions apply to general LR as well.

ANOVA model

One particularly popular special case of LR is the ANOVA model. This occurs when the independent variables Embedded Image are binary indicators, representing different levels of a categorical or ordinal variable for multiple groups. The conditional mean of Y in equation (2) becomes the group mean. For example, if there are three groups, we may use group 1 as the referent and the other two independent variables Embedded Image to represent groups 2 and 3:

Embedded Image

In this case, the LR in equation (1) becomes:

­

Embedded Image

Thus, the regression coefficients become the group mean of Y :

Embedded Image

where Embedded Image denotes the mean of Y for group k (Embedded Image ).

Because of the relationship of the coefficient with the group mean, the ANOVA is often simply expressed as:

Embedded Image (3)

where Embedded Image denotes the outcome from the i th subject within the k th group, Embedded Image is the (population) mean of the kth group, and K is the total number of groups. For the one-way ANOVA in equation (3) the linearity assumption does not apply, as Embedded Image represents the group mean and no linear or any relationship is assumed between the group means. The normality and homoscedasticity become easier to interpret and check as well, as they apply to distributions of Embedded Image within each group.

Under ANOVA, comparisons of group means across all groups are readily expressed by a null, Embedded Image , and alternative Embedded Image hypothesis as:

Embedded Image (4)

Under the null hypothesis Embedded Image , all groups have the same mean. If Embedded Image is rejected, post hoc analyses are followed to determine the groups that have different group means. We focus on the hypothesis in equation (4) for overall group difference below, but the same conclusions apply to post hoc pairwise group comparisons as well.

ANOVA uses F-tests for testing the null hypothesis of no group difference in equation (4). This omnibus test is defined by elements of a so-called ANOVA table:

In the above table,

Embedded Image

where Embedded Image is the sample mean of group k , Embedded Image is the sample mean of the entire sample (grand mean), N is the total sample size from all groups, Embedded Image denotes sum of all Embedded Image , and Embedded Image denotes sum of Embedded Image over both indices k and i. The terms SS(R), SS(E) and SS(Total) are called the regression, error and total sum of squares, respectively, and M S(R) and MS(R), obtained by dividing SS(R) and SS(E) by their respective df, are called the mean regression and the mean error sum of squares mean. The three sums of squares are related as:

Embedded Image

where Embedded Image and Embedded Image form a partition of Embedded Image .

Under the null of no group difference, the sample group mean Embedded Image will be close to the sample grand mean, Embedded Image , in which case Embedded Image will be close to 0 and Embedded Image will be close to Embedded Image . Otherwise, Embedded Image will be different from 0 with its magnitude reflecting differences between the group means and Embedded Image will account for a smaller portion of Embedded Image in this case. Thus, relationships between SS(R) and SS(E) indicate if there is evidence of differences in group means. By normalising the two by number of groups and sample size, the F-test is defined by their normalised counterparts, MS(R) and MS(R) .

Under the null hypothesis H 0, the F statistic, or the ratio Embedded Image , follows the F distribution:

Embedded Image (5)

where F I −1,NI denotes the F distribution with K–1 (numerator) df and N–K (denominator) df. As a smaller MS(R) relative to MS(E) indicates evidence supporting the null and vice versa, this is consistent with the fact that a larger value of the F statistic leads to rejection of the null and vice versa.

As the F-test is derived under ANOVA in equation (3), validity of the F distribution for the F statistic in equation (5) depends on (A) normality and (B) homoscedasticity. Under both assumptions, the outcomes Embedded Image do follow a normal distribution for each group, and all groups have the same variance. As noted earlier, the extant literature has largely focused on normality with little discussion on homoscedasticity. Next, we use MC simulation to examine the performance of the F-test under departures from each assumption.

Simulation study

To evaluate the performance of the F-test when either normality or homoscedasticity is violated, we use MC simulated data to create multiple samples from an ANOVA. By repeatedly testing the null of no group mean difference using each simulated sample and comparing the per cent of times when the null is rejected with a prespecified type I error, we can see how each assumption impacts the performance of the F-test. We start with specifying an ANOVA from which samples will be drawn using MC simulation.

For brevity and without loss of generality, we consider three groups with a common mean μ and group size n, in which case the ANOVA in equation (3) simplifies to:

Embedded Image (6)

We set Embedded Image , Embedded Image and consider testing the null of no group difference,

Embedded Image (7)

Thus, the null hypothesis H 0 is true for the ANOVA in equation (6). If we set type I error level to, say, α=0.05, and repeatedly test the null hypothesis using data Y ki sampled from the ANOVA in equation (6) using MC simulation, we expect to reject the null H 05% of the times. We will refer to per cent of times when the null is rejected through repeated testing from multiple samples (MC simulated samples in the current setting) as empirical type I errors.

For evaluating the performance of the F-test under non-normal distribution, we simulate the error terms Embedded Image in equation (6) from (A) a centred and rescaled χ2 with 1 df and (B) a centred and rescaled Weibull distribution with both shape and scale equal to 1, so the resulting distributions in both cases have mean 0 and variance 1. In this case, the simulated Y ki have the same mean (μ=0) and variance (σ=1) across the three groups. However, as the Y ki no longer follow the normal distribution, the F-test in equation (5) may not follow the F distribution, in which case we may not reject the null H 0 5% of the times if we set the nominal level as α=0.05.

To evaluate the impact of homoscedasticity on type I errors, we consider two scenarios: (a) all three groups have different variances, and (b) one group has a different variance than the other two groups:

Embedded Image

In each scenario above, we consider three sets of variances indexed by k (=1, 10, 100). As differences between the variances become larger as k varies from 1 to 10 to 100, this setting will show if increased degree of heteroscedasticity will have a larger effect on type I errors.

To reduce the sampling variability, we set MC sample size to M=1000. We consider the three sample sizes (A) Embedded Image , (B) Embedded Image and (C) Embedded Image to see if and how sample size will affect the performance of the F-test.

Shown in table 1 are empirical type I errors for testing the null of no group mean difference by the F-test from 1000 MC simulated outcomes under the ANOVA in equation (6) with no violation and violation of each of the two assumptions. If none of the assumptions is violated, empirical p values are quite close to their nominal counterparts. When normality is not met, there is downward bias in empirical p values for sample size n=10, but the bias seems to have disappeared when n=100 and n=1000. When homoscedasticity is violated, however, there is clearly upward bias in both scenarios. Also, the bias becomes larger as the degree of heteroscedasticity increases under both scenarios. The first scenario has a larger bias than the second, which is expected since it has a higher degree of heteroscedasticity than the second scenario. Moreover, unlike the case of violation of normality, the upward bias becomes larger as sample size increases from 10 to 100 to 1000. An increased empirical type I error means the likelihood of rejecting the null hypothesis is higher than the specified nominal level, yielding a higher rate of false positives.

Table 1

Empirical type I errors for testing the null of no difference in group mean across three groups in equation (7) from the F-test based on 1000 Monte Carlo simulated samples from the ANOVA in equation (6) under (A) no violation of normality and homoscedasticity, (B) violation of normality and (C) violation of homoscedasticity for sample size n=10, 100 and 1000 with nominal type I error α=0.05 and α=0.01

Discussion

In this report, we examined the performance of the F-test in one-way ANOVA using MC simulation when data violate the (1) normality and (2) homoscedasticity assumption. Our simulation results show that although there is downward bias in type I errors for extremely small sample size (n=10), it virtually disappears for moderate (n=100) and large (n=1000) sample sizes. The diminishing bias as sample size increases is not a coincidence and is actually the working of a mechanism known as the central limit theorem in statistics.3 Thus, unless sample size is small (eg, less than n=50), normality can be ignored when applying ANOVA.

In contrast, the F-test is more sensitive to departures from homoscedasticity. Our simulation study results show that type I errors are upwardly biased when groups have different variances. Moreover, unlike violation of normality, the amount of bias persists and actually increases as sample size increases. Thus, one needs to pay close attention to this assumption when applying ANOVA. If violation of this assumption is suspected either by formal testing4 or rule of thumb (eg, the ratio of the largest to the smallest variance is larger than 2), one may need to apply other tests for comparing group means. For example, the KW test may be used for inference. However, as this test generally has lower power, one may opt for modern alternatives such as the semiparametric models, which provide inference for linear and more general regression models without imposing any distributional distribution.3 Unlike the KW test, semiparametric models use original continuous outcomes and thus provide more power than the KW test. We will compare the KW test and applications of semiparametric models to ANOVA in a future article.

References

Kun Yang graduated from Huazhong Agricultural University in 2016. He has been reading for a master’s degree of bioinformatics in Huazhong Agricultural University since 2016. Now he is studying and working at University of California, San Diego, as a visiting student. His research interests include bioinformatics, biostatistics and machine learning.


Embedded Image

Footnotes

  • Contributors KY conceived the initial idea, searched the literature on related topics, performed analyses involving Monte Carlo simulations and assisted in manuscript preparation. JT conceived the initial idea, participated in the discussion of the statistical problems and their implications in biomedical research, wrote parts of the manuscript and helped finalise the manuscript. TC researched the statistical issues, directed simulation studies, drafted parts of the manuscript and finalised the manuscript. All authors provided critical feedback and helped shape the research, analysis and the manuscript.

  • Funding The authors have not declared a specific grant for this research from any funding agency in the public, commercial or not-for-profit sectors.

  • Competing interests None declared.

  • Patient consent for publication Not required.

  • Provenance and peer review Commissioned; internally peer reviewed.