(Biological Data analysis) All work must be done in R programing. -#6 (Simulatio
ID: 3180512 • Letter: #
Question
(Biological Data analysis)
All work must be done in R programing.
-#6 (Simulation) – Set the random number seed to 0 and draw a random sample of size 1000 from X ~ N(0,1) and Y ~ N(1,1). Perform the appropriate hypothesis tests to test for a two-sided test for the equality of means. Assume that you know nothing about the data and perform all of the needed steps. Assume that the 2 samples are independent. [Use a t-based test statistic]
-(Simulation) – Repeat your analysis of #6 using X~N(0,1) and Y ~ N(1,3). Don’t forget to set the seed to 0. Once again assume that you know nothing about the data and perform all of the necessary steps. Once again assume the two samples are independent.
Explanation / Answer
6. H0: There is no significance difference between the means of two populations
H1: There is significance difference between the means of two populations
Let the level of significance be alpha = 5%
In R,
> set.seed(0)
> x=rnorm(1000,mean=0,sd=1)
> y=rnorm(1000,mean=1,sd=1)
> t.test (x,y,var.equal=T,conf.level = 0.05,alternative="two.sided")
Output:
Two Sample t-test
data: x and y
t = -21.811, df = 1998, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
5 percent confidence interval:
-0.9938928 -0.9881935
sample estimates:
mean of x mean of y
-0.01582957 0.97521356
Here p-value is less than alpha 0.05, we reject H0
Thus, we conclude that There is significance difference between the means of two populations
Again
H0: There is no significance difference between the means of two populations
H1: There is significance difference between the means of two populations
Let the level of significance be alpha = 5%
In R,
> set.seed(0)
> x=rnorm(1000,mean=0,sd=1)
> y=rnorm(1000,mean=1,sd=3)
> t.test (x,y,var.equal=F,conf.level = 0.05,alternative="two.sided")
Welch Two Sample t-test
data: x and y
t = -9.1384, df = 1203.7, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
5 percent confidence interval:
-0.9479319 -0.9350086
sample estimates:
mean of x mean of y
-0.01582957 0.92564067
Here p-value is less than alpha 0.05, we reject H0
Thus, we conclude that There is significance difference between the means of two populations
> set.seed(0)
> x=rnorm(1000,mean=0,sd=1)
> y=rnorm(1000,mean=1,sd=1)
> t.test (x,y,var.equal=T,conf.level = 0.05,alternative="two.sided")
Output:
Two Sample t-test
data: x and y
t = -21.811, df = 1998, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
5 percent confidence interval:
-0.9938928 -0.9881935
sample estimates:
mean of x mean of y
-0.01582957 0.97521356
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.