Solved – Confidence intervals and pairwise comparisons

confidence intervalmultiple-comparisonspaired-comparisonspaired-data

Let us say I have the following pair wise test data:

batch        1    2    3    4   5   6   7   8   10
non-control  18   16   15   19  36  24  25  30  31
control      20   23   25   19  28  24  26  21  22

Each data point is measurement of some attribute X in some units

The control part of the pair share some underlying similarity to the non-control pair

The non-control part of the pair share some underlying similarity to the control pair except that is has received an exposure to say a chemical C.

Now how would I prove (or disprove) if there is strong evidence (or the lack of it) that the exposure the chemical C results in greatly increased measurements of attribute X?

How would I construct a confidence interval of the difference between the values of the con-control and control (say 90%) for the difference between attribute X between the control and non-control versions of the measurements.

This is more to further my understanding but basically I want to apply two tests:

  1. Sign Test
  2. Wilcoxon Signed Rank Test

Thanks.

Best Answer

This "R" code produces accurate results ONLY if your test is RANDOMIZED

rm(list=ls())
batch <- seq_len(10); batch
nonControl <- c(18,16,15,19,36,24,25,30,31)
control <- c(20,23,25,19,28,24,26,21,22)

pairedDifference <- nonControl - control; pairedDifference
pairedDifferenceMean <- mean(pairedDifference); pairedDifferenceMean
pairedDifferenceSumOfSquares <- sum((pairedDifference - pairedDifferenceMean)^2); pairedDifferenceSumOfSquares

degreesOfFreedom <- length(pairedDifference)-1; degreesOfFreedom
pairedVariance <- pairedDifferenceSumOfSquares/degreesOfFreedom; pairedVariance
pairedStandardDeviation <- sqrt(pairedVariance);pairedStandardDeviation
pairedStandardError <- pairedStandardDeviation/sqrt(degreesOfFreedom+1); pairedStandardError

As can be seen below:

According to the null hypothesis, the difference population mean equals zero, the reference distribution against which the observed "pairedDifferenceMean" = 0.6666667 may be viewed as a scaled t distribution with eight degrees of freedom centered at zero with a scale factor "pairedStandardError" of 2.285218. The value of "tSubZero", below, associated with the null hypothesisis:

tSubZero <- pairedDifferenceMean/pairedStandardError; tSubZero
significanceLevel <- 1-pt(tSubZero, df=degreesOfFreedom); significanceLevel
Related Question