# Testing hypothesis for teh equality of medians of two related populations #Set working directory setwd("~/Dropbox/ISI SCB/Data sets") # read in csv file dg <-read.csv("drugs.csv", TRUE) x <- dg$Drug.B y <- dg$Drug.A #check for ties d=x-y md <- median(d) md d-md #Since there are two ties (1st and 9th cases) #we will remove the 1st case x1 <- x[2:12] y1 <- y[2:12] d1=x1-y1 #check for outliers boxplot(d1) #assess normality assumptions of x and y qqnorm(d1, ylab = "d Sample Quantiles") shapiro.test(d1) #Wilcocox test for for medians of 2 related populations wilcox.test(x1,y1, paired=TRUE, alternative = "greater", conf.int=TRUE) # Parametric test on original data t.test(x,y, paired=TRUE, alternative = "greater")