11/6/2020

Hypothesis Testing: The 7-Steps

In this presentation, we will be going over the subject of Hypothesis Testing in Statistics.

Specifically, we will be going over one of the most important topics:

The 7-Steps of Statistical Hypothesis Testing


We will first define some terms as well as the steps, then show a couple examples.

Step 1: State Your Null Hypothesis

Let’s start with stating our null hypothesis. Our null hypothesis is represented by the symbol:

\[Ho\]

This is essentially the opposite of the “guess” made by the researcher. Unless we are able to reject this through hypothesis testing, we will take this as is.

When testing a model, the first step is to conduct a Global \(F\)-Test , which tests the overalll adequacy of a model. The typical null hypothesis for a Global \(F\)-Test would read as follows: \[Ho: B_{1} = B_{2} = ... B_{i} = 0\]

This suggests that all of the \(B\)s (known as “ Betas ” or “ Parameter Estimates ”) in the regression model equal zero, meaning none of them have any correlation to the independent variable (which is really bad!).

Parameter Estimates can be thought of as slopes. That is, if \(B_{1}\) was, say, \(5.3\), \(x_{1} =\) Hours of Sleep and \(y =\) Exam Percentage, then we would interpret this as:

  • For every one hour increase of sleep, exam percentage increases 5.3 percentage points, holding all else constant.

Note: If all of the Parameter Estimates were zero, we wouldn’t be able to make these practical interpretations.

Step 2: State Your Alternative Hypothesis

Our alternative hypothesis is represented by the symbol:

\[Ha\]

The alternative hypothesis in the Global \(F\)-Test reads as follows:

\(Ha\): At least one \(B_{i}\) differs from zero.

This doesn’t mean all of the \(B\)s differ from zero, but it means that at least one of the independent variables in the model has shown some effect on the dependent variable.

(The model can be further fit via other tests, but we will stick to this one for now)

We are left with:

  • \(Ho: B_{1} = B_{2} = ... = B_{i} = 0\)

  • \(Ha\): At least one \(B_{i}\) differs from zero

Null & Alternative Hypotheses Examples

Here are examples of other types of Hypothesis Tests:

Right-Tailed Tests \[Ho: B_{1} = 0\] \[Ha: B_{1} > 0\]
or:
\[Ho: B_{1} \leq 0\] \[Ha: B_{1} > 0\] Left-Tailed Tests \[Ho: B_{1} = 0\] \[Ha: B_{1} < 0\]
or:

\[Ho: B_{1} \geq 0\] \[Ha: B_{1} < 0\]

Step 3: Set Your Alpha \(\alpha\)

Setting your significance level, or Alpha \(\alpha\), can help determine whether we should accept or reject \(Ho\).

Typically, statisticians will set \(\alpha = 0.05\), meaning that there is a \(5\)% chance that their conclusion is wrong.

Still, that leaves a \(95\)% chance that it is right.

This also means that, if you want to reject your null hypothesis, you’re going to want to end up with \(p-value < 0.05\).

Whenever \(p-value < \alpha\), you reject your null hypothesis.

Subsequently, whenever \(p-value > \alpha\), you do not reject your null hypothesis.

Type I and Type II Errors

Here is a table summarizing Type I and Type II Errors in Hypothesis Testing:

Note : Both error types are bad, but the severity of each can vary depending on the situation.

Step 4: Collect Data

This is where the researcher really gets to set the tone for their hypothesis testing.

Pay attention to:

  • Whether data is collected via experimental design or observational means.

  • The nature of the data

  • What type of questions you want to ask about the data

  • What you expect from the data

Step 5: Calculate a Test Statistic

There are many different formulas for calculating different types of test statistics, but they all serve the same purpose.

Test statistics are used to help determine whether or not to reject \(Ho\).

They are compared to the Critical Value(s) based on the \(\alpha\) you set.

Reject \(Ho\) if:

Right-Tailed

\(t-statistic > t-critical\)

Left-Tailed

\(t-statistic < t-critical\)

Two-Tailed \(- t.statistic < - t.critical\) or \(t.statistic > t.critical\)

Step 6: Construct Rejection Regions

The Rejection Region represents an interval that leads to the rejection of \(Ho\). Even though we are looking at a Two-Tailed F-Test , here is a summary of the rejection regions of one-tailed tests as well:

RejReg

Step 7: Draw a Conclusion About \(Ho\)

After you have completed Steps 1-6, you have plenty of information to help you decide whether or not to reject \(Ho\).

The actual conclusions would be unique to every test, but in general, conclusions read as follows:

If \(Ho\) is Not Rejected:

  • There is not sufficient evidence to reject \(Ho\).

If \(Ho\) is Rejected:

  • There is sufficient evidence to reject \(Ho\).

Additional Example: Correlation Hypothesis Test

Let’s look at another hypothesis test. This one involves correlation. For this example, let’s look at the data set “Trees.”

We see that the data set includes variables “Girth,” “Height,” and “Volume.”

Independent Variables

  • Girth
  • Height

Dependent Variable

  • Volume

Let’s first graph each of these and see if we can identify any correlation between the independent and dependent variables.

Example (data)

Here is the head of the “Trees” data set.

head(trees)
##   Girth Height Volume
## 1   8.3     70   10.3
## 2   8.6     65   10.3
## 3   8.8     63   10.2
## 4  10.5     72   16.4
## 5  10.7     81   18.8
## 6  10.8     83   19.7

We see that there are three variables: Girth, Height, and Volume.

Since it makes the most sense to look at Girth and Height as functions of Volume, let’s see if there’s any type of relationship between them by graphing the data.

Example (Girth vs. Volume)

Example: Girth vs. Volume (Interactive)

Example (Height vs. Volume)

Example: Height vs. Volume (Interactive)

Example: Correlation Matrix

Both Girth and Height seem to have a positive linear correlation to Volume.

If we want to be thorough, we should run some tests to make sure this apparent correlation is statistically significant.

Example: Calculations

To make things easier, let’s assume we’ve already calculated the correlation coefficients, \(r\). First, we need to define our Alpha.

Let’s set \(\alpha = 0.05\).

The formula for the test statistic is:

\[t = \frac{r\sqrt{n - 2}}{\sqrt{1 - r^2}}\] The \(p\)-value is then calculated using the \(t\)-distribution and \(n - 2\) degrees of freedom.

You can then compare the \(t\) test statistic to the \(p\)-value to see if it falls in a rejection region.

Example: The Easier Way

Luckily, we live in the 21st century and have technology. There are many ways to compute these test statistics and \(p\)-values, and there are many different types of statistical software out there (R included) that can help us.

This is especially useful when we start adding more variables to our analysis, as well as transforming them.

Example: Correlation Matrix

If you look at the correlation matrix on the next slide, you will notice that the two independent variables have fairly strong positive correlations to the dependent variable.

(That is, the correlation coefficients are close to or greater than \(0.6\), as seen in the first matrix)

The correlation matrix also runs its own hypothesis tests, which would read as follows:

\(\rho = 0\) (No correlation)

\(\rho \neq 0\) (Some correlation)

The second matrix entitled “P” shows the \(p\)-values for each correlation. Luckily, all of the ones we want have \(p\)-values less than \(0.05\), so we can say that there is sufficient evidence to reject the claim that there is no relationship between our \(x\)’s and \(y\).

The End! Correlation Matrix (table)

Correlation Matrix previously mentioned:

pcorr = rcorr(as.matrix(trees))
pcorr ## Correlation Matrix using R
##        Girth Height Volume
## Girth   1.00   0.52   0.97
## Height  0.52   1.00   0.60
## Volume  0.97   0.60   1.00
## 
## n= 31 
## 
## 
## P
##        Girth  Height Volume
## Girth         0.0028 0.0000
## Height 0.0028        0.0004
## Volume 0.0000 0.0004