The null hypothesis is that the means are equal between the machines. While the alternative is that there is a non-zero difference. ## Question 2.24b a t-test is performed to test the hypothesis
mac1 <- c(16.03,16.04,16.05,16.05,16.02,16.01,15.96,15.98,16.02,15.99)
mac2 <- c(16.02,15.97,15.96,16.01,15.99,16.03,16.04,16.02,16.01,16)
t.test(mac1,mac2)
##
## Welch Two Sample t-test
##
## data: mac1 and mac2
## t = 0.79894, df = 17.493, p-value = 0.435
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.01635123 0.03635123
## sample estimates:
## mean of x mean of y
## 16.015 16.005
Based on the P-value of 0.435 we reject the null hypothesis
##2.24c
The P value for this experiment is .435, this means that there is a 43.5% chance of the null being incorrect.
##2.24d
the 95% confidence interval of the differences between means is [-0.01635123 , 0.03635123]#meaning that 95% of mean differences are in that range
t1 <- c(65,81,57,66,82,82,67,59,75,70) # type 1
t2 <- c(64,71,83,59,65,56,69,74,82,79) # type 2
var.test(t1,t2)
##
## F test to compare two variances
##
## data: t1 and t2
## F = 0.97822, num df = 9, denom df = 9, p-value = 0.9744
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.2429752 3.9382952
## sample estimates:
## ratio of variances
## 0.9782168
An F-test is done to analyse if equal variance can be assumed.
The ratio from the F-test is close to one and with a small sample size we can assume equal variance.
##2.26b
We use levene’s t-test to determine if the flare vary with time
t.test(t1,t1,var.equal = T) # Levene's test is performed when var.equal is TRUE
##
## Two Sample t-test
##
## data: t1 and t1
## t = 0, df = 18, p-value = 1
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -8.704119 8.704119
## sample estimates:
## mean of x mean of y
## 70.4 70.4
with a P-value of 1 we do not reject the null hypthesis and it can be said with high certainty that the flares do not vary in time.
Data prep
v95 <- c(11.176,7.089,8.097,11.739,11.291,10.759,6.467,8.315)
v100 <- c(5.263,6.748,7.461,7.015,8.133,7.418,3.772,8.963)
##2.29a
By performing a 1-sided t-test testing for a lower difference in means we can determine if higher tempertures yield thinner layers
t.test(v100,v95,alternative = "l")
##
## Welch Two Sample t-test
##
## data: v100 and v95
## t = -2.6751, df = 13.226, p-value = 0.009423
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -0.8539293
## sample estimates:
## mean of x mean of y
## 6.846625 9.366625
It can be inferred from the t-test that at temperatures of 100 C the thickness is lesser than 95C
The P-value for this test is .0094 which means that the results of the t-test are significant and the null is rejected. This means that at higher tempertures thinner layers are formed
##2.29c
The 95% confident interval on the difference in means is [-Inf -0.8539293] With the range being completly negative it can be inferred that all diffrences in means will be negative which proves that baking at 100 C provides as thinner coating.
We can test for normality by using a Normal probability plots and histograms
qqnorm(v95)
qqline(v95)
hist(v95)
qqnorm(v100)
qqline(v100)
hist(v100)
Due to small sample the histograms and NPP plots look a little skewed
but, they are fairly normal but it appears that there is a skew for the
95 C run.
#Question 2.24
mac1 <- c(16.03,16.04,16.05,16.05,16.02,16.01,15.96,15.98,16.02,15.99)
mac2 <- c(16.02,15.97,15.96,16.01,15.99,16.03,16.04,16.02,16.01,16)
#datq1 <- data.frame(mac1, mac2) # It's not necessary to place the vectors into a data frame
# first a dataframe with the data was created ma1 contains data for
#machine 1 & mc2 has data for machine 2
#Question 2.24a ______________________________________
# the null hypothesis is that the means are equal between the machines.
#While the alternative is that there is a non-zero difference.
#Question 2.24b_______________________________________________________________
# a t-test is performed to test the hypothesis
t.test(mac1,mac2)
# Based on the P-value of 0.435 we reject the null hypothesis
#2.24c The P value for this experiment is .435, this means that there is a 43.5% chance of the null being incorrect.
#is true and there is a non zero difference in the means
#2.24d
# the 95% confidence interval of the differences between means is [-0.01635123 , 0.03635123]
#meaning that 95% of mean differences are in that range
#________________________________________________________________________________________________
#Question 2.26
# Preparation
t1 <- c(65,81,57,66,82,82,67,59,75,70) # type 1
t2 <- c(64,71,83,59,65,56,69,74,82,79) # type 2
#2.26a
var.test(t1,t2)
# the ratio from the F-test is close to one and with a small sample size we can assume equal variance.
t.test(t1,t1,var.equal = T) # Levene's test is performed when var.equal is TRUE
# 2.26b
# with a p value of 1 we do not reject the null hypthesis and it can be said with high certainty that the machines fill to the same volume
t.test(t1,t1,var.equal = T) # Levene's test is performed when var.equal is TRUE
#2.29_________________________________________________-_____________________________________
v95 <- c(11.176,7.089,8.097,11.739,11.291,10.759,6.467,8.315)
v100 <- c(5.263,6.748,7.461,7.015,8.133,7.418,3.772,8.963)
t.test(v100,v95,alternative = "l")
#by performing a 1-sided t-test testing for a lower difference in means
#It can be inferred from the t-test that at temperatures of 100 C the thickness is lesser than 95C
#2.29b the P-value for this test is .0094 which means that the results of the t-test are significant and the null is rejected
#29.9c the 95% confident interval on the difference in means is [-Inf -0.8539293]
# with the range being completly negative it can be inferred that all diffrences in means will be negative which proves that baking at
#100 C provides as thinner coating.
#29.9e
# we can test for normality by using a Normal probability plots and histograms
qqnorm(v95)
hist(v95)
qqline(v95)
qqnorm(v100)
qqline(v100)
hist(v100)
#Due to small sample the histograms and NPP plots look a little skewed but, they are fairly normal but it appears that there is a skew for the 95 C run