# This file is stored as lead.R # The data file is posted under the name # lead.txt. It does not have variable names # on the first line. Enter the data # into a data frame. lead <- read.table("c:/stat565/lead.txt", header=F, col.names=c("pair", "case", "control")) lead$diff<-lead$case-lead$control # Print the data frame lead # Paired t-testel t.test(lead$case, lead$control, paired=T) # Wilcoxon signed rank test wilcox.test(lead$case, lead$control, paired=T) # Exact binomial p-value for the sign test sdiff<-sign(lead$diff) n1 <- sum(sdiff > .5) n2 <- sum(sdiff < -.5) binom.test(n1, n1+n2, p=.5, alternative="two.sided")