2.4 Nested summary of diet

2.4.1 By cow:

It is of interest to note that each of the three diet types is given in each yard. Be aware of reverse causation - high protein milk does not necessarily influence diet type!

rm_covsum_nested(data = Milk, id = c("Cow"), covs = c("protein", "High_Protein", "Time", "Yard"), maincov = "Diet")
Full Sample (n=79) barley (n=25) barley+lupins (n=27) lupins (n=27) Unnested p-value Unnested Effect Size Unnested StatTest Nested p-value
protein 0.003 0.17 Kruskal Wallis, Eta sq 0.78
Mean (sd) 3.4 (0.2) 3.5 (0.2) 3.4 (0.1) 3.3 (0.2)
Median (Min,Max) 3.4 (2.9, 3.9) 3.6 (3.2, 3.9) 3.4 (3.2, 3.7) 3.3 (2.9, 3.7)
High Protein 0.010 0.34 Chi Sq, Cramer’s V 0.80
N 63 (80) 15 (60) 23 (85) 25 (93)
Y 16 (20) 10 (40) 4 (15) 2 (7)
Time 0.97 0.001 Kruskal Wallis, Eta sq 0.99
Mean (sd) 9.0 (1.1) 9.1 (1.2) 9.0 (1.1) 9.0 (1.1)
Median (Min,Max) 10.0 (7.1, 10.4) 10.0 (7.1, 10.4) 10.0 (7.5, 10.1) 10.0 (7.5, 10.2)
Yard 0.85 0.16 Chi Sq, Cramer’s V 1.00
1 15 (19) 6 (24) 6 (22) 3 (11)
2 16 (20) 4 (16) 5 (19) 7 (26)
3 17 (22) 4 (16) 7 (26) 6 (22)
4 16 (20) 7 (28) 4 (15) 5 (19)
5 15 (19) 4 (16) 5 (19) 6 (22)

However, it appear that each cow was assigned to only one diet over all observation instances. Diet 1 = barley, 2 = barley+lupins and 3 = lupins.

Diet_t <- reshape2::dcast(Milk, Yard + Cow ~ Time, value.var="Diet_Type");
colnames(Diet_t)[-c(1:2)] <- paste("", colnames(Diet_t[, -c(1:2)]), "", sep = "");

options(knitr.kable.NA = '');
knitr::kable(Diet_t);
Yard Cow 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1 B03 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 B13 1 1 1 1 1 1 1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