Print
Paired Mean of Differences One-Line Test
Read It: Paired Mean of Differences One-Line Test
To conduct the one-line test for a paired mean of differences hypothesis test, you will use a t-test for two related samples. Below, we demonstrate how to implement this code.
Watch It: Video - Hypothesis Test for Two Samples: Mean of Differences (Paired Comparison) (2:03 minutes)
Try It: Google Colab
- Click the Google Colab file used in the video here.
- Go to the Colab file and click "File" then "Save a copy in Drive", this will create a new Colab file that you can edit in your own Google Drive account.
- Once you have it saved in your Drive, try to edit the following code to run the paired mean of differences one-line test. Remember to import the libraries and run the code to create some data.
Note: You must be logged into your PSU Google Workspace in order to access the file.
# Libraries import numpy as np import scipy.stats as stats # create some data x = np.random.randint(0,100,1000) y = np.random.randint(0,200,1000) # implement one-line test results = ... results.pvalue
Once you have implemented this code on your own, come back to this page to test your knowledge.