# Why different results for the same factor once using Oneway and once Twoway ANOVA?

I am currently analysing data of eggs of laying hens that were fed with different forage. There were two forage in total, and eight group of laying hens. Four groups under forage 1 and four groups under forage 2.

I am using R and am performing some ANOVAs for different factors and dependant variables. Right now, the factor of interest is the eight groups of hens.

When I set the parameter "shell strength" (measured in N) as the dependant variable in an ANOVA test with factor groups, then I get two different p-values. With an Oneway ANOVA, I get a p-value of 0.03186 which is significant. On the countrary, with a Twoway ANOVA, I get a p-value of >0.05 which in my case is not significant.

I am quite a beginner in stats and also in R so I do not quite understand why the results differ. Maybe someone has an explanation for me? On researchgat.net, someone suggested to check the explained variance of both tests. In my case I get an explained variance of 0.69 for the Oneway and of 0.63 for the Twoway ANOVA. He then recommended to take the p-value of the test with the greater explained variance. What do you think?

Every response will be greatly appreciated! Best regards

Edit: Here is the code.

-BF stands for "egg strength", dependant variable

-Abteil stands for "group", there are 8 of them

# Oneway ANOVA
fac2 <- as.factor(sheet_all$$Abteil) # Factor group (8 levels) onewayANOVA <- aov(sheet_all$$BF ~ fac2)
summary(onewayANOVA)

# Twoway ANOVA
fac1 <- as.factor(sheet_all$$Verf) # Factor forage (2 levels) fac2 <- as.factor(sheet_all$$Abteil) # Factor group (8 levels)
twowayANOVA <- aov(sheet_all$BF ~ fac1*fac2) summary(twowayANOVA)  Here are both outputs I get. > fac2 <- as.factor(sheet_all$$Abteil) > onewayANOVA<- aov(sheet_all$$BF ~ fac2) > summary(onewayANOVA) Df Sum Sq Mean Sq F value Pr(>F) fac2 7 1109 158.50 2.221 0.0319 * Residuals 392 27978 71.37 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > fac1 <- as.factor(sheet_all$$Verf) > fac2 <- as.factor(sheet_all$$Abteil) > twowayANOVA <- aov(sheet_all$BF ~ fac1*fac2)
> summary(twowayANOVA)
Df Sum Sq Mean Sq F value Pr(>F)
fac1          1    365   364.8   5.111 0.0243 *
fac2          6    745   124.1   1.739 0.1107
Residuals   392  27978    71.4
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Dataframe that is being used:

> head(sheet_all)
# A tibble: 6 x 21
Stall Abteil Verf     LP Ei-Nb    EG    BF Dotterfarbe Flecken Eiklarhöhe
<chr>  <dbl> <chr> <dbl>   <dbl> <dbl> <dbl>       <dbl>   <dbl>      <dbl>
1 2.1.      11 K         9       1  71.7    43          11       0        9.6
2 2.1.      11 K         9       2  70.7    41          11       1        7
3 2.1.      11 K         9       3  73.5    57          11       0        9.6
4 2.1.      11 K         9       4  62.6    54          12       1        8.8
5 2.1.      11 K         9       5  72.6    47          10       0       10
6 2.1.      11 K         9       6  61.3    45          11       0        8.7
# ... with 11 more variables: Haugh_units <dbl>, Dottergewicht <dbl>,
#   Dotter_percent <dbl>, Schalengewicht <dbl>, Schalen_percent <dbl>,
#   Eiweissgewicht <dbl>, Weiss_percent <dbl>, Schalendicke1 <dbl>,
#   Schalendicke2 <dbl>, Schalendicke <dbl>, Date <dttm>

New contributor
arkadryyx is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• Hi, could you possibly add the code you used for your models in your question? That will be helpful – Lachlan yesterday
• @Lachlan Yes of course. Thank you! – arkadryyx yesterday
• There are a series of weird things going on here. For one, you've specified an interaction in your second model, but it isn't present in the results. Also, the residual degrees of freedom aren't changing between the models, when they really should be.. Can you run head() on your dataframe? e.g. head(sheet_all) and post the results? – Lachlan yesterday
• Yes, also for me as a beginner it surprised me that there was no interaction in the output of the two-way ANOVA. Now you can take a look at my dataframe. Hope you understand a bit of German ;-) – arkadryyx yesterday