100% Guaranteed Results


GR5206 – Lab 5 Solved
$ 29.99
Category:

Description

5/5 – (1 vote)

Hanao Li hl3202
Instructions
Goal
The goal of this lab is to investigate the empirical behavior of a common hypothesis testing procedure through simulation using R. We consider the traditional two-sample t-test.
Two-Sample T-Test
Consider an experiment testing if a 35 year old male’s heart rate statistically differs between a control group and a dosage group. Let X denote the control group and let Y denote the drug group. One common method used to solve this problem is the two-sample t-test. The null hypothesis for this study is:
H0 : μ1 − μ2 = Δ0,
where Δ0 is the hypothesized value. The assumptions of the two sample pooled t-test follow below:
Assumptions Procedure
The test statistic is
tcalc ,
n
where x¯,y¯ are the respective sample means and s are the respective sample standard deviations.
The approximate degrees of freedom is
( s21 s22 )2 m + n
df =
m−1 n−1
Under the null hypothesis, tcalc has a student’s t-distribution with df degrees of freedom.
Rejection rules
Reject H0 when:
Pvalue ≤ α
Tasks
1. Using the R function t.test, run the two sample t-test on the following simulated dataset. Note that the t.test function defaults a two-tailed alternative. Also briefly interpret the output.

2. Write a function called emperical.size that simulates R different samples of X for control and R different samples of Y for the drug group and computes the proportion of test statistics that fall in the rejection region. The function should include the following:
I started the function below:

Evaluate your function with the following inputs R=10,mu1=10,mu1=12,sigma1=5 and sigma2=5.

3. Assuming the null hypothesis
H0 : μ1 − μ2 = 0
is true, compute the empirical size using 10,000 simulated data sets. Use the function emperical.size to accomplish this task and store the object as sim. Output the empirical size quantity sim$size. Comment on this value. What is it close to?
Note: use mu1=mu1=10 (i.e., the null is true). Also set sigma1=5,sigma2=5 and n=m=30.

4. Plot a histogram of the simulated P-values, i.e., hist(sim$pvalue.list). What is the probability distribution shown from this histogram? Does this surprise you?

5. Plot a histogram illustrating the empirical sampling sampling of the t-statistic, i.e., hist(sim$statistic.list,probability =TRUE). What is the probability distribution shown from this histogram?

6. Run the following four lines of code:
emperical.size(R=1000,mu1=10,mu1=10,sigma1=5,sigma2=5)$emperical.size emperical.size(R=1000,mu1=10,mu1=12,sigma1=5,sigma2=5)$emperical.size emperical.size(R=1000,mu1=10,mu1=14,sigma1=5,sigma2=5)$emperical.size emperical.size(R=1000,mu1=10,mu1=16,sigma1=5,sigma2=5)$emperical.size
Comment on the results.

7. Run the following four lines of code:
emperical.size(R=10000,mu1=10,mu2=12,sigma1=10,sigma2=10,m=10,n=10)$emperical.size emperical.size(R=10000,mu1=10,mu2=12,sigma1=10,sigma2=10,m=30,n=30)$emperical.size emperical.size(R=10000,mu1=10,mu2=12,sigma1=10,sigma2=10,m=50,n=50)$emperical.size emperical.size(R=10000,mu1=10,mu2=12,sigma1=10,sigma2=10,m=100,n=100)$emperical.size
Comment on the results.

Reviews

There are no reviews yet.

Be the first to review “GR5206 – Lab 5 Solved”

Your email address will not be published. Required fields are marked *

Related products