Overview
I have a data set in which the quantity I care about is the sum of several sub-quantities, each of which is measured in triplicate. I'd like to test they hypothesis that there are differences between the sums (and then to find the relative order of the sums).
What I'm thinking of would be analogous to one-way ANOVA with Tukey HSD post-hoc analysis on the sums. The problem is that the labels on the replicates are totally arbitrary, so it doesn't make sense to just add up all replicates A, then all replicates B, etc. How can handle this?
Details
My data take this form:
$$ y_T = \Sigma_{i=1}^6 \bar{y_i} $$
where T indicates a treatment and
$$ \bar{y_i} = \frac{y_{i,A} + y_{i,B} + y_{i,C}}{3}$$
Since the label replicates are arbitrary, $y_{1,A}$ is no more similar to $y_{2,A}$ than it is to $y_{2,B}$ or $y_{2,C}$, it doesn't make sense to calculate
$$\bar{y_A} = \Sigma_{i=1}^6 y_{i,A}$$
I want to test whether there are significant differences among $y_T$, and then to do a post-hoc analysis of which ones are mutually indistinguishable.
Code for example data set
set.seed(0)
treatment <- gl(3, k=18, labels = c("T1", "T2", "T3"))
ps <- gl(6, k = 3, length = length(treatment))
reps <- gl(3, k = 1, length = length(treatment), labels = c("A", "B", "C"))
values <- runif(length(treatment))
df <- data.frame(treatment, ps, reps, values)
I'm trying to see whether the heights of the big bars are different from one another. For these purposes I don't care whether there are differences among the smaller bars within one big bar.
ggplot(df, aes(x=treatment, y=values, fill=ps)) +
geom_bar(stat="identity")
A monte carlo approach?
Seems like there's some kind of Monte Carlo approximation, where I would reshuffle the replicate labels and possibly the sub-quantity labels, do an ANOVA, and measure f. But I can't quite put together in my head how that would work.
Similar questions
- My question is superficially similar to this one although I don't think that question has replicates in the same way mine does.