test assumptions and pairwise comparisons

I know the pairwise graphs are not the way they are supposed to look. I could not figure out how to get the data given in the problems properly in R so I could use it. Each comparison printed the format correctly, but it did not insert any of the values I need to make conclusions.

I can access data given in R (like CO2 InsectSPrays, ToothGrowth, etc.) and use that properly, but when it comes to entering my own data I can not seem to figure it out. If you could help me apply this, I would greatly appreciate it.

  1. Assumptions: The experiment is randomized, and the sham was controlled. Assume independence between the times of the PEMF. I believe since the sham is controlled we can use Dunnetts test for pair wise comparison. I could not find a dunnett function for R to test it that way.
sham <- c(4.51,7.95,4.97,3.00,7.97,2.23,3.95,5.64,9.45,6.52,4.96,6.10,7.19,4.03,2.72,9.19,5.17,5.70,5.85,6.45)
PEMF1 <- c(5.32,6.00,5.12,7.08,5.48,6.52,4.09,6.28,7.77,5.68,8.47,4.58,4.11,5.72,5.91,6.89,6.99,4.98,9.94,6.38)
PEMF2 <- c(4.73,5.81,5.69,3.86,4.06,6.56,8.34,3.01,6.71,6.51,1.70,5.89,6.55,5.34,5.88,7.50,3.28,5.38,7.30,5.46)
PEMF4 <- c(7.03,4.65,6.65,5049,6.98,4.85,7.26,5.92,5.58,7.91,4.90,4.54,8.18,5.42,6.03,7.04,5.17,7.60,7.90,7.91)

pairwise.t.test(PEMF1+PEMF2+PEMF4, sham, p.adjust.method = "bonferroni")
## 
##  Pairwise comparisons using t tests with pooled SD 
## 
## data:  PEMF1 + PEMF2 + PEMF4 and sham 
## 
##      2.23 2.72 3 3.95 4.03 4.51 4.96 4.97 5.17 5.64 5.7 5.85 6.1 6.45 6.52
## 2.72 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 3    -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 3.95 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 4.03 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 4.51 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 4.96 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 4.97 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 5.17 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 5.64 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 5.7  -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 5.85 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 6.1  -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 6.45 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 6.52 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 7.19 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 7.95 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 7.97 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 9.19 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
## 9.45 -    -    - -    -    -    -    -    -    -    -   -    -   -    -   
##      7.19 7.95 7.97 9.19
## 2.72 -    -    -    -   
## 3    -    -    -    -   
## 3.95 -    -    -    -   
## 4.03 -    -    -    -   
## 4.51 -    -    -    -   
## 4.96 -    -    -    -   
## 4.97 -    -    -    -   
## 5.17 -    -    -    -   
## 5.64 -    -    -    -   
## 5.7  -    -    -    -   
## 5.85 -    -    -    -   
## 6.1  -    -    -    -   
## 6.45 -    -    -    -   
## 6.52 -    -    -    -   
## 7.19 -    -    -    -   
## 7.95 -    -    -    -   
## 7.97 -    -    -    -   
## 9.19 -    -    -    -   
## 9.45 -    -    -    -   
## 
## P value adjustment method: bonferroni
  1. Assumptions: Assume indepedence between the mixing types. TukeyHSD can be used here or bonferroni.
mt <- c(1,2,3,4)
ts1 <- c(3129, 3000, 2865, 2890)
ts2 <- c(3200, 3300, 2975, 3150)
ts3 <- c(2800, 2900, 2985, 3050)
ts4 <- c(2600, 2700, 3600, 2765)

pairwise.t.test(ts1+ts2+ts3+ts4, mt, p.adjust.method = "bonferroni")
## 
##  Pairwise comparisons using t tests with pooled SD 
## 
## data:  ts1 + ts2 + ts3 + ts4 and mt 
## 
##   1 2 3
## 2 - - -
## 3 - - -
## 4 - - -
## 
## P value adjustment method: bonferroni
  1. Assumptions: This experiment was randomized and single-factor. Assume independence between the different dosage levels.
dosage <- c(20,30,40)
ob20 <- c(24,28,37,30)
ob30 <- c(37,44,31,35)
ob40 <- c(42,47,52,38)

pairwise.t.test(ob20,ob30,ob40, p.adjust.method = "bonferroni")
## 
##  Pairwise comparisons using t tests with pooled SD 
## 
## data:  ob20 and ob30 
## 
##    31 35 37
## 35 -  -  - 
## 37 -  -  - 
## 44 -  -  - 
## 
## P value adjustment method: bonferroni
  1. Assumptions: The rental contracts are chosen at random. Each contract is independent of the others. TukeyHSD would work here as well as bonferroni.
car <- c("subcompact", "Compat", "Midsize", "Full size")
sub <- c(3,5,3,7,6,5,3,2,1,6)
comp<- c(1,3,4,7,5,6,3,2,1,7)
mid <- c(4,1,3,5,7,1,2,4,2,7)
full<- c(3,5,7,5,10,3,4,7,2,7)

#pairwise.t.test(sub+comp+mid+full, p.adjust.method = "bonferroni")
# this would not run without an error, so I made it a comment so that I could knit it and submit it.