# Deviation of independence assumption in the t test

How does deviations from the assumption of independence affect the t-test for β1 in linear regression (y=β0+β1x)? How does it affect the null distribution of the test statistic.

• Do you mean $y=\beta_0 + \beta_1x$?
– Dave
Commented Apr 6, 2021 at 14:13
• yes I do, edited the question! Commented Apr 6, 2021 at 15:07

There are several basic t-tests, so I will assume you're talking about the "independent samples t-test". In short, if your data are not independent, the t-test is completely invalid. As an illustration, we can consider the case in which X is binary; in this case, a simple linear regression is equivalent to a t-test of means between two groups (the mean of one group is $$\beta_0$$ and the mean of the other group is $$\beta_0+\beta_1$$).

As an example, let's say you are trying to compare water quality in Seattle vs. Portland. Your boss asks you to sample water from 100 homes in each city and test it for lead content. Let's say the null hypothesis is true; both cities have an average of 8 parts per billion (ppb) lead in their water. Some homes have a bit more (up to 10ppb), some homes have a bit less (as low as 6ppb). Now, let's say you're super lazy and instead of visiting 100 different homes, you take 100 samples from a single home in Seattle and 100 samples from a single home in Portland. In other words, your data are highly dependent. You go back to your lab and analyze the 200 samples and see that the lead content is as follows:

Seattle: 7.001, 6.988, 7.012, 7.006, ...
Portand: 9.011, 9.005, 8.992, 9.003, ...


A t-test is definitely going to reject the null hypothesis with a tiny P-value. But it is completely invalid because your samples do not represent independent samples from each city.

• The question concerns a t-test of the slope in a simple regression. You seem to be discussing a different situation.
– whuber
Commented Apr 6, 2021 at 17:14
• @whuber, I don't think it's a different situation in the case of a binary predictor (which is a convenient way to illustrate the problem of dependent data). In a simple linear regression with a binary predictor, you have two groups defined by a variable X. The mean in the X=0 group is given by beta_0 and the mean in the X=1 group is given by beta_0+beta_1. The t-test with equal variances is equivalent to linear regression with homoskedastic errors and the t-test with unequal variances is equivalent to linear regression with heteroskedastic errors. Commented Apr 6, 2021 at 18:09
• Right, I was hoping that's how you viewed it. Might I suggest that you make that connection explicit in your answer?
– whuber
Commented Apr 6, 2021 at 18:40
• @whuber, great idea, let me edit accordingly Commented Apr 6, 2021 at 21:07