Consider the following two-sample data from Real Statistics:
The results for this dataset are:
Recall from Lesson 08 that the two-sample t statistic is defined as:
whereis the pooled standard deviation:
Questions & Tasks
In order to complete the tasks below, you will need the following packages:
import numpy as np from scipy import stats from matplotlib import pyplot as plt
Task 1: Write a function called
t_two_sample which (1) has two input arguments:
yB, and which (2) calculates the t-value for a two-sample test.
Task 2: Use your
t_two_sample function to verify the t value reported for the dataset above ( ).
Task 3: Use
scipy.stats.t.sf to verify the p value reported for the dataset above ( ).
Task 4: Simulate at least 1000 two-sample experiments to numerically verify the reported p value ().
- See Lesson 09 for examples of experiment simulations.
- For each experiment, use your
t_two_samplefunction (above) to calculate the two-sample t value.
- Also use:
- (sample size)
- (means when is true)
- (true SD values)
- (number of experiments)
- When simulating experiments, ensure that you use the Normal distribution (np.random.randn) and NOT the Uniform distribution (np.random.rand)
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: firstname.lastname@example.org 微信号:vipnxx