Solved – Pairwise comparison of vectors with unequal sizes and unequal variances

multiple-comparisonsr

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.

Best Answer

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.