# Transforming two-way ANOVA into one-way ANOVA by ignoring one factor

I'm building up a sample to test if the water consumption (for example) changes among two smart technologies water-machines (A and B), and I'm adding another group C for control (standard machine). I have 80 smart-technologies of A and another 80 for B, therefore I'll also have 80 for control. I will also test this across the country in 4 different geographic locations (1,2,3,4), i.e, 20 of A, 20 of B, and 20 of C for each location. In this example, I can run two-way ANOVA with two factors: (A, B, C) and (1,2,3,4).

My question however is the following:

Since each group of A, B, and C (80 each) will already have their machines split equally (20 for each location), can I ignore the variable of location (1,2,3,4) and just do a One-way ANOVA?

If the water consumption depends on the location (which I don't know at the moment), can I still do this?

EDIT: My concern is because if I do a two-way anova, I will have 12 groups, and my sample size will reduce. And if the sample size is small my test will have less power.

You have 240 measurements in all.

(a) If your one-way ANOVA would have 12 levels (A1, A2, A3 ,A4, B1, ..., C4), each with 20 replications, that might be OK for a start.

Model:

$$Y_{ik} = \mu + \alpha_i + e_{ik},$$ where $$i = 1,2,\dots,12$$ levels, $$k=1,2,\dots,20$$ replications, and $$e_{ik} \stackrel{iid}{\sim} \mathsf{Norm}(0,\sigma).$$

Rows in the ANOVA table would be Factor with DF= 12 - 1 = 11, Error with DF = 228, and (possibly) Total with DF = 240 - 1 = 239.

However, if you were to find significant differences among these 24 levels, you would likely want to use contrasts to untangle whether technologies A,B,C differ, whether locations 1,2,3,4 differ (and possibly to explore technology-by-location interactions). So this legitimate ANOVA would a reasonable start only if you strongly suspect that neither technology nor location really matters.

Here are data simulated to have no effects, and a 12-factor ANOVA as discussed above. [Notice that it is necessary to declare factor variables.]

set.seed(324)
y = rnorm(240, 50, 7)
fact = factor(rep(1:12, each = 240/12))
anova(lm(y~fact))
Analysis of Variance Table

Response: y
Df  Sum Sq Mean Sq F value Pr(>F)
fact       11   480.6  43.695  0.8803 0.5604
Residuals 228 11317.0  49.636


(b) By contrast, if you mean a bogus "one-way ANOVA" with three levels A, B, C, pretending you have 80 "replications" at each level, that is not OK.

The 80 "replications" may not be IID (in case locations differ), thus having unexpectedly high variability. Whatever power you might gain by having 80 replications, might well be more than lost by having four potential chunks of 20, each with a different mean.

• If you get a significant result, you will have an idea that technologies matter, but not by how much.

• If you don't, you won't know whether that's because there is nothing to discover about different technologies, or whether real effects are masked by inflated variances.

• Untangling significance of locations, or of some combination them with technologies would not be feasible. It would be necessary to go back and run the authentic two-way ANOVA.

Two-way model:

$$Y_{ijk} = \mu + \tau_i + \lambda_j + \gamma_{ij} + e_{ijk},$$ where $$i = 1,2,\dots,3$$ technologies, $$j = 1,2,3,4$$ locations; $$k=1,2,\dots,20$$ replications, $$\gamma_{ij}$$ are interaction effects, and $$e_{ijk} \stackrel{iid}{\sim} \mathsf{Norm}(0,\sigma).$$

Rows in an ANOVA table would be Tech with DF = (3-1) = 2, Loc with DF = (4-1) = 3, Tech-by-Loc interaction with DF = 2(3) = 6, and Error/Residual with DF = 12(19) = 228, and (possibly) Total with DF = 240 - 1 = 239.

Here are data simulated in R to show a significant Tech effect and a strongly significant Loc effect, but no interaction, along with their correct two-way ANOVA:

set.seed(325)
x = rnorm(240, 50, 7)
tech = rep(1:3, each=80)
loc =  rep(1:4, times=60)
Tech= factor(tech)        # Mandatory declaration...
Loc = factor(loc)         #  ... of factor variables
y = 3*loc + 1.6*tech + x  # Can't do arithmetic with...
#  ... with factor variables
anova(lm(y~Tech+Loc+Tech:Loc))

Analysis of Variance Table

Response: y

Df Sum Sq Mean Sq F value    Pr(>F)
Tech        2  235.9  117.94  3.0923   0.04731 *
Loc         3 3003.4 1001.13 26.2489 1.271e-14 ***
Tech:Loc    6  416.8   69.46  1.8213   0.09585 .
Residuals 228 8695.9   38.14
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


However, if I try a bogus ANOVA with only Tech is a factor, I do not find significance at the 5% level. The result is the opposite of what you intended. The larger variability in the bogus replications has masked the Tech effect. There are more 'replications', but not useful ones.

Bogus one-way 'ANOVA':

anova(lm(y~Tech))

Analysis of Variance Table

Response: y

Df  Sum Sq Mean Sq F value Pr(>F)
Tech        2   235.9 117.939   2.307 0.1018
Residuals 237 12116.0  51.122