首页 » Python代写 » Python统计代写|Bonus Assignment: Simulating experiments

Python统计代写|Bonus Assignment: Simulating experiments

本次英国代写是一个Python统计的assignment

Overview

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:

where sp is the pooled standard deviation:

Questions & Tasks

In order to complete the tasks below, you will need the following packages:

In [1]:
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: yA and 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 ( t=2.177 ).

Task 3: Use scipy.stats.t.sf to verify the p value reported for the dataset above ( p=0.022 ).

Task 4: Simulate at least 1000 two-sample experiments to numerically verify the reported p value ( p=0.022 ).

Hints:

  • See Lesson 09 for examples of experiment simulations.
  • For each experiment, use your t_two_sample function (above) to calculate the two-sample t value.
  • Also use:
    • nA=nB=10 (sample size)
    • μA=μB=0 (means when H0 is true)
    • σA=σB=1 (true SD values)
    • N≥1000 (number of experiments)
  • When simulating experiments, ensure that you use the Normal distribution (np.random.randn) and NOT the Uniform distribution (np.random.rand)

程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。