# Pairwise comparison of vectors with unequal sizes and unequal variances

I have 3 vectors which are unequal in size (lengths: 21, 33 and 7). Each vector contains ratio of bug-to-duplicate bugs in 3 different time periods. I have to find whether there is a difference between the 3 groups.

I cannot use one-way ANOVA since the groups have unequal sample sizes and unequal variances. I cannot use TukeyHSD because of unequal variances. Is Dunnett's modified Tukey Kramer test the only test available for such a kind of data? If, so how to interpret the results of that test since the Dunnett's test in R does not provide a p-value?

Is chi-squared test applicable to this data?

Thanks.

• it sounds like chi-square... I don't see how length has a ratio. I'm guessing you can interpret these as count data somehow. Please detail the data better. – John Feb 27 '12 at 3:20
• Hi John, I am comparing the ratio of # of bugs to # of duplicate bugs per month in Mozilla project from Nov06 to Oct11. I had to split this into 3 groups based on months before and after release of Firefox 3 and months after release of Firefox 4. Hence I get 3 groups with lengths mentioned in the question. – Nitin Mohan Feb 27 '12 at 4:43
• So what are your 21 points in the first vector - is it 21 numbers, each of them between zero and one? – Peter Ellis Feb 27 '12 at 6:02
• your response in no way further clarifies what the data are... how is a vector of 21 numbers a ratio? – John Feb 27 '12 at 6:47
• Here is the data set that I am working on dl.dropbox.com/u/6967747/ratio.csv – Nitin Mohan Feb 27 '12 at 19:30

From the sounds of it, you are comparing mean levels of outcome in 3 different groups. Linear regression will do this, and if you want robustness against different variances in the different groups, robust estimates of standard error can be used to take care of this.

Here's some R code that generates some example data, does the linear regression, computes robust standard errors, and performs a test that all three group means are equal

# generate the data
set.seed(4)
y1 <- rnorm(21, mean=3, sd=3)
y2 <- rnorm(33, mean=2, sd=3.5)
y3 <- rnorm(7, mean=4, sd=2.4)
y <- c(y1, y2, y3)
group <- factor(rep(1:3, times=c(21,33,7)))

# do the regression
lm1 <- lm(y~group)

# perform the test, using robust standard errors
library("sandwich") # you may need to install these packages
library("lmtest")

waldtest(lm1, vcov=vcovHC(lm1) )


If the variance doesn't differ very much between groups, you'll probably be fine without the robust standard errors.

• Isn't the issue that each data point is a ratio? so they can't be normally distributed with eg mean 3, sd3. – Peter Ellis Feb 27 '12 at 5:44
• the Normality of the data in the code isn't an assumption in the analysis, it's just a way of generating random variables. I put in difference variances because the questioner mentioned them. With the use of robust standard errors, we don't need assumptions of Normality, or constant variance. – guest Feb 27 '12 at 6:18
• Thanks for the info guys... This is the dataset that I am working on dl.dropbox.com/u/6967747/ratio.csv . There are 3 periods (PreBreakpad, PostBreakpad, PostRapid) and I have to find whether the ratio differs between the groups. – Nitin Mohan Feb 27 '12 at 19:49
• Yes, now I understand the data I think this method will work fine. – Peter Ellis Feb 27 '12 at 20:05
• Hi Peter, Do you mean "guest"'s method works fine for this data set? – Nitin Mohan Feb 27 '12 at 20:10

'Robust' bootstrap methods with trimmed means? See

Wilcox, R. R. (2010). Fundamentals of Modern Statistical Methods: Substantially Improving Power and Accuracy, 2nd Edition. New York: Springer

Code can be found in Wilcox's R package WRS2 (on CRAN).