Regression t-Test


Input Sample Data

What data source will you be using?


Note: These are common data sets. If you want to learn more about them, feel free to look on Google!


Enter data into the text box below for each sample.

  • All values must be numeric, and numbers should contain no spaces or any characters other than a '.' for a decimal place.
  • Each value must be on it's own line, or comma seperated.
  • There must be the same number of values in each textbox.
  • Don't forget to press 'Upload' once you are finished!

x-axis:

y-axis:



Warning: You must have at least two unique values in your manually specified data.

In order to proceed, you must select some data to act as your sample.




The Null and Alternate Hypotheses

When looking at the other t-tests, we motivated them using the box model. While you could motivate the regression test using a box model, it is much trickier, and could lead to increased confusion. Instead, we will state the null hypothesis outright.

A linear regression line, has the form: \( Y = \beta_0 + \beta_1X + \epsilon \)
Here:

  • \(\beta_0\) is the \(Y\)-intercept.
  • \(\beta_1\) is the gradient (coefficient of \(X\)).
  • \(\epsilon\) is the residual error (error that the model doesn't explain).

The null hypothesis is \(\beta_1 = 0\). In other words, that there is no linear relationship between \(X\) and \(Y\). Similar to the other tests, you can choose which type of alternate hypothesis you want:

Null Hypothesis

\( H_0: \) \( \beta_1 = 0 \)

Alternate Hypothesis




Assumptions

For the hypothesis test to be valid, we need to check the following assumptions:

The relationship between \(X\) and \(Y\) is linear.

How do we check?

  • Look at a scatterplot of \(X\) vs \(Y\). There should be a straight-line trend (check the graph on the left below).
  • Look at a residual plot for the linear equation where \(X\) is the independent variable and \(Y\) is the dependent variable. It should show homoscedasticity with no pattern (check the graph on the right below).

The second assumption is that the residuals show homoscedasticity, that is, the residuals have constant varaince across \(X\).

How do we check?

  • Residual plot: The spread of the residuals should be equal (check the graph below).

The third assumption is that the residuals should be approximately normally distributed.

How do we check?

First, a bit of context. The reason why we care about this assumption is because the regression t-test relies on the sample distribution of the slope \(\beta_1\) being approximately normal.

However, lucky for us, the CLT tell us that the sampling distribution will approach normality regardless of the residual distribution, provided the sample size is large enough.

The reason we are interested in checking that the residuals are normally distributed is that we may be unsure as to whether the CLT applies. For example, we may be unsure whether we have enough points for the CLT to apply in our circumstance. If we see that the residuals are normally distributed, we can be more confident that the CLT applies.

There are two main ways to check this assumption:

  • QQ-plot: see if the residuals follow the diagonal QQ-line (see below).
  • Number of points: You can make reference to the sample size when making your decision about this assumption. For example, if you see some slight deviations in normality (when looking at the qq-plot), but have a large sample size, you have more confidence that the CLT will apply.

The second assumption is the independence of residuals. The assumption is that the residuals are unrelated to each other.

How do we check?

There are some advanced methods used to detect this. Two methods that you could use:

  • Residual plot against observation order: This is a plot of residuals in the order the data was collected or indexed. If we see a random scatter of points, this suggests independence. On the other hand, patterns, trends or clusters could suggest dependence (check the graph on the left below).
  • Standard residual plot: If the residuals show a systematic shape or wave, it could suggest dependence, that is, the residuals are not independent (check graph on the right below).



Test Statistic

Step 1) Calculate Expected Value (\(\mathbb{E}\)) and Standard Error (\(\text{SE}\))

Step 2) Test Statistic Calculation




p-value



Conclusion (p-value)

Step 1) What is your significance level?

\( \alpha = \)

Error: The value for α must be between 0 and 1.

Step 2) Final Conclusion




Conclusion (Confidence Interval)

A confidence interval in a regression test gives a range of values for the true population slope that are consistent with the observed data at the chosen confidence level. In informal terms, we can think of this as the range of plausible values for the effect of the predictor on the response.

We can also use the confidence interval to guide hypothesis testing: if 0 (representing no linear association between predictor and response) does not lie within the confidence interval, then we reject the null hypothesis. If 0 does lie within the interval, we do not reject the null.

Step 1) What is your confidence level?

\( \alpha = \)

Error: The value for confidence level must be between 0 and 1.

Step 2) Final Conclusion