Math411 Key_Lab 2
.pdf
keyboard_arrow_up
School
Drexel University *
*We aren’t endorsed by this school
Course
411
Subject
Mathematics
Date
Feb 20, 2024
Type
Pages
10
Uploaded by ChiefOtter2846
1/23/24, 9:32 PM
Math411 Key_Lab 2
file:///Users/zacharykey/Math411-Key_Lab-1.html
1/10
Math411 Key_Lab 2
2024-01-17
T-test for Two Independent Random Samples
Exercise 1
#A
Null Hypothesis: The population length mean in small and large bass are equal.
Alternative Hypothesis: The population length mean in small and large bass are not equal.
Assumptions: 1. Samples are collected randomly from each of the two populations of interest. 2.The variable is
measured on a continuous scale 3.The variable is approximately normally distributed
#B #two sample t-test mean1=272.8
mean2=164.8
sd1=96.4
sd2=40
n1=125
n2=97
ttest=(mean1-mean2)/sqrt(((sd1*sd1)/n1)+(sd2*sd2)/n2)
ttest
## [1] 11.33153
tcrit=qt(.05/2,sd2-1,lower.tail = F)
tcrit
## [1] 2.022691
The t-test gave a value of 11.33 while the t-critical value come out to be 2.023. Since the t value is greater than
the t-critical value we would reject the null. This means that the population lengths of the large and small bass are
probability not equal.
1/23/24, 9:32 PM
Math411 Key_Lab 2
file:///Users/zacharykey/Math411-Key_Lab-1.html
2/10
#C lb=(mean1-mean2)-tcrit*sqrt((sd1^2/n1)+(sd2^2/n2))
ub=(mean1-mean2)+tcrit*sqrt((sd1^2/n1)+(sd2^2/n2))
bin=c(lb,ub)
bin
## [1] 88.72189 127.27811
#D
In part B the comparison between the t-value and t-critical value supported that the population mean lengths
were not equal to each other. In part C we were to find the 95% confidence interval in the difference of the means.
If they were equal the values should have been zero but in this case the difference ranged from 89.23 to 126.76.
#E largebass=rnorm(n=n1,mean=mean1,sd=sd1)
smallbass=rnorm(n=n2,mean=mean2,sd=sd2)
t.test(largebass,smallbass,varequal=T)
## ## Welch Two Sample t-test
## ## data: largebass and smallbass
## t = 11.552, df = 181.32, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 93.39527 131.86998
## sample estimates:
## mean of x mean of y ## 274.2540 161.6213
The output of the random sample of each population when run through a t-test gave us a t-value of 11.728 and a
p-value less than 2.2e-16. The p-value being less than our critical value 0.05 supports the rejection of the null.This
shows that even in a random sample of the data the population mean length is probability not going to be equal.
Exercise 2
#A
Null:The population mean reaction time between men and women are equal.
Alternative: The population mean reaction time between men and women are not equal.
1/23/24, 9:32 PM
Math411 Key_Lab 2
file:///Users/zacharykey/Math411-Key_Lab-1.html
3/10
Assumptions: 1.Samples are collected randomly from each of the two populations of interest. 2.The variable is
measured on a continuous scale 3.The variable is approximately normally distributed
#B mean_1=170.21
mean_2=181.31
s_1=32.643
s_2=45.988
n_1=58
n_2=68
ttest2=(mean_1-mean_2)/sqrt(((s_1*s_1)/n_1)+(s_2*s_2)/n_2)
ttest2
## [1] -1.578112
tcrit2=qt(.05/2,n_1-1,lower.tail = F)
tcrit2
## [1] 2.002465
Taking the absolute value of our t-value it comes out to be 1.58 while the t-critical value is 2.002. Since the t-
critical value is greater that means we fail to reject the null. This means that there is a high chance that the
population times are equal to each other.
#C lower=(mean_1-mean_2)-tcrit*sqrt((s_1^2/n_1)+(s_2^2/n_2))
upper=(mean_1-mean_2)+tcrit*sqrt((s_1^2/n_1)+(s_2^2/n_2))
bin2=c(lower,upper)
bin2
## [1] -25.327044 3.127044
#D
In part B the comparison between the t-value and t-critical value supported that the population mean times were
equal to each other. In part C we were to find the 95% confidence interval in the difference of the means. If they
were equal the values should have been zero in this case it goes through zero as the difference ranged from
-25.327 to 3.127 meaning that they could be equal.
1/23/24, 9:32 PM
Math411 Key_Lab 2
file:///Users/zacharykey/Math411-Key_Lab-1.html
4/10
#E
men=rnorm(n=n_1,mean=mean_1,sd=s_1)
women=rnorm(n=n_2,mean=mean_2,sd=s_2)
t.test(men,women,varequal=T)
## ## Welch Two Sample t-test
## ## data: men and women
## t = -3.2586, df = 123.96, p-value = 0.001445
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -35.00852 -8.55077
## sample estimates:
## mean of x mean of y ## 165.2034 186.9830
The output of the random sample gave a t-value of -1.9544 and a p-value of 0.05298.The p-value is greater than
the critical value of 0.05. This means that there is not enough evidence to reject the null. This shows that even in a
random sample of the data the population mean times are probability going to be equal.
Exercise 3
#A
Null Hypothesis:The mean growth length is equal in treated vs untreated plants
Alternative Hypothesis: The mean growth length is not equal in treated vs untreated plants.
Assumptions: 1.Samples are collected randomly from each of the two populations of interest. 2.The variable is
measured on a continuous scale 3.The variable is approximately normally distributed
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help