1 Unpaired Design

Example of Comparing Modified and Unmodified Cement

1.2 Draw boxplot

1.3 Perform two sample t-test (with equal variance assumption)

## 
##  Two Sample t-test
## 
## data:  mod and unmod
## t = -9.1094, df = 18, p-value = 3.678e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.4250734 -0.8909266
## sample estimates:
## mean of x mean of y 
##    16.764    17.922
## 
##  Welch Two Sample t-test
## 
## data:  mod and unmod
## t = -9.1094, df = 17.025, p-value = 5.894e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.4261741 -0.8898259
## sample estimates:
## mean of x mean of y 
##    16.764    17.922

1.5 Testing equality of variance

## 
##  F test to compare two variances
## 
## data:  mod and unmod
## F = 1.6293, num df = 9, denom df = 9, p-value = 0.4785
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.4046845 6.5593806
## sample estimates:
## ratio of variances 
##           1.629257
## [1] 1.629257
## [1] 0.4784603

2 Paired Design

Consider an experiment to compare two methods, MSI and SIB, to determine chlorine content in sewage effluents. Eight samples were collected at different doses and contact times. Two methods were applied to each of the eight samples. It is a paired comparison design because the pair of treatments are applied to the same samples (or units).

2.1 Read Data

Sample MSI SIB Diff
1 0.39 0.36 -0.03
2 0.84 1.35 0.51
3 1.76 2.56 0.80
4 3.35 3.92 0.57
5 4.69 5.35 0.66
6 7.70 8.33 0.63
7 10.52 10.70 0.18
8 10.92 10.91 -0.01

2.2 Drawing boxplot

2.4 Drawing difference vs sample

2.5 Testing for the difference in means

## 
##  Welch Two Sample t-test
## 
## data:  MSI and SIB
## t = -0.19831, df = 13.993, p-value = 0.8457
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.888792  4.061292
## sample estimates:
## mean of x mean of y 
##   5.02125   5.43500
## 
##  Paired t-test
## 
## data:  MSI and SIB
## t = -3.6454, df = 7, p-value = 0.008228
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.6821314 -0.1453686
## sample estimates:
## mean of the differences 
##                -0.41375
## 
##  One Sample t-test
## 
## data:  MSI - SIB
## t = -3.6454, df = 7, p-value = 0.008228
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  -0.6821314 -0.1453686
## sample estimates:
## mean of x 
##  -0.41375