Two machines fill bottles to a net volume of 16 oz. The filling process is assumed to be normal, with stdev1 of .015 and stdev2 of .018. The quality department suspects they both fill exactly the same volumes, whether or not it’s actuall 16. An expirement is performed:
data <- c(16.03, 16.04 ,16.05, 16.05 ,16.02 ,16.01, 15.96, 15.98 ,16.02 ,15.99 ,16.02 ,15.97 ,15.96 ,16.01 ,15.99 ,16.03 ,16.04 ,16.02 ,16.01 ,16.00)
machine <- c(1, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
dafr <- data.frame(data,machine)
Ho:µ1= µ1 Ha:µ1≠ µ1
t.test(subset(dafr$data,dafr$machine==1),subset(dafr$data,dafr$machine==2))
##
## Welch Two Sample t-test
##
## data: subset(dafr$data, dafr$machine == 1) and subset(dafr$data, dafr$machine == 2)
## 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
We fail to reject the null hypothesis (that the difference in means is = 0) because or p value is above the alpha of .05. These is not enough evidence to show that the two machines fill to different levels.
The p value is shown to be 0.435
The confidence interval is shown to be (-0.01635123, 0.03635123)
The following is two burning times for two different formulas. We are interested in both the mean and the variance of the bubrning times.
data <- c(65, 81, 57, 66, 82, 82, 67, 59, 75, 70, 64, 71, 83, 59, 65, 56, 69, 74, 82, 79)
type <- c(1, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
dafr <- data.frame(data,type)
library(lawstat)
levene.test(dafr$data,dafr$type)
##
## Modified robust Brown-Forsythe Levene-type test based on the absolute
## deviations from the median
##
## data: dafr$data
## Test Statistic = 1.2813e-31, p-value = 1
We do not reject the hypothesis that these to are the same. There is not enough evidence to indicate that the variability of the burning times of these two chemicals is different.
t.test(subset(dafr$data,dafr$type==1),subset(dafr$data,dafr$type==2))
##
## Welch Two Sample t-test
##
## data: subset(dafr$data, dafr$type == 1) and subset(dafr$data, dafr$type == 2)
## t = 0.048008, df = 17.998, p-value = 0.9622
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -8.552517 8.952517
## sample estimates:
## mean of x mean of y
## 70.4 70.2
The p value is .9622. This means we also do not reject the null hypothesis, meaning there is not enough evidence that the means of the two burning times are different either.
Here are measurement of phtoresistor chip thickness after being baked at 2 different temperatures.
data <- c(11.176,7.089,8.097,11.739,11.291,10.759,6.467,8.315,5.263,6.748,7.461,7.015 ,8.133,7.418, 3.772,8.963)
temp <- c(95,95,95,95,95,95,95, 95,100,100,100,100,100,100,100,100)
dafr <- data.frame(data,temp)
t.test(subset(dafr$data,dafr$temp==95),subset(dafr$data,dafr$temp==100))
##
## Welch Two Sample t-test
##
## data: subset(dafr$data, dafr$temp == 95) and subset(dafr$data, dafr$temp == 100)
## t = 2.6751, df = 13.226, p-value = 0.01885
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.4884278 4.5515722
## sample estimates:
## mean of x mean of y
## 9.366625 6.846625
Yes, there is enough evidence to state that these to samples do not have equal means, and additionally the mean of the 100C is lower
The p value is states to be .01885
The confidence interval is stated to be (0.4884278, 4.5515722) This can be interpreted as the amount of variation expected in the means 95% of the time. We would expect the means to fall between these two values 95% of the time.
qqnorm(subset(dafr$data,dafr$temp==95),col='blue',ylim=c(6,12))
qqline(subset(dafr$data,dafr$temp==95),col='blue')
par(new=TRUE)
qqnorm(subset(dafr$data,dafr$temp==100),col='red',ylim=c(6,12))
qqline(subset(dafr$data,dafr$temp==100),col='red')
We can see here that both the red and the blue lines (temp 100C and temp95C, respectively) both seem to be centered around their respective lines, though red clearly has smaller values then blue. Though there are not many data points from which to tell, they both do appear to be normal because of that centered quality.