2.2 Nested summary of high protein status

2.2.1 By cow:

There are 72 cows that had at least one instance of milk with high protein content. Every cow (all 79) had at least one instance of milk with low protein content.

rm_covsum_nested(data = Milk, id = c("Cow"), covs = c("protein", "Time", "Diet", "Yard"), maincov = "High_Protein")
## Warning in (function (data, covs, maincov = NULL, id = NULL, digits = 1, : Use this function at your own risk. Please check output.
## Order of nested ids matter. For example, in c('id1','id2') id1 should be nested within id2, etc.
## Warning in (function (data, covs, maincov = NULL, id = NULL, digits = 1, : Unnested p-value and statistical test is incorrect for nested data, but is kept for comparison to nested p-value.
## Nested p-value derived from anova(afex::mixed(maincov ~ cov + (1|id1:id2:...idn), family=binomial, data, method='LRT')).
Full Sample (n=79) N (n=79) Y (n=72) Unnested p-value Unnested Effect Size Unnested StatTest Nested p-value
protein <0.001 0.86 Wilcoxon Rank Sum, Wilcoxon r Did not converge;
quasi or complete
category separation
Mean (sd) 3.4 (0.2) 3.3 (0.1) 3.8 (0.1)
Median (Min,Max) 3.4 (2.9, 3.9) 3.3 (2.9, 3.5) 3.8 (3.6, 4.2)
Time 0.001 0.26 Wilcoxon Rank Sum, Wilcoxon r 0.024
Mean (sd) 9.0 (1.1) 9.2 (1.5) 7.4 (4.3)
Median (Min,Max) 10.0 (7.1, 10.4) 9.4 (2.5, 12.5) 7.7 (1.0, 18.0)
Diet 0.89 0.039 Chi Sq, Cramer’s V <0.001
barley 25 (32) 25 (32) 24 (33)
barley+lupins 27 (34) 27 (34) 26 (36)
lupins 27 (34) 27 (34) 22 (31)
Yard 1.00 0.014 Chi Sq, Cramer’s V 0.68
1 19 (24) 19 (24) 17 (24)
2 11 (14) 11 (14) 10 (14)
3 17 (22) 17 (22) 15 (21)
4 11 (14) 11 (14) 10 (14)
5 21 (27) 21 (27) 20 (28)

2.2.2 By cow nested in yard:

Notice that this summary is the same as by cow, since each cow stays in only one yard for this example data.

rm_covsum_nested(data = Milk, id = c("Cow", "Yard"), covs = c("protein", "Time", "Diet"), maincov = "High_Protein")
Full Sample (n=79) N (n=79) Y (n=72) Unnested p-value Unnested Effect Size Unnested StatTest Nested p-value
protein <0.001 0.86 Wilcoxon Rank Sum, Wilcoxon r Did not converge;
quasi or complete
category separation
Mean (sd) 3.4 (0.2) 3.3 (0.1) 3.8 (0.1)
Median (Min,Max) 3.4 (2.9, 3.9) 3.3 (2.9, 3.5) 3.8 (3.6, 4.2)
Time 0.001 0.26 Wilcoxon Rank Sum, Wilcoxon r 0.024
Mean (sd) 9.0 (1.1) 9.2 (1.5) 7.4 (4.3)
Median (Min,Max) 10.0 (7.1, 10.4) 9.4 (2.5, 12.5) 7.7 (1.0, 18.0)
Diet 0.89 0.039 Chi Sq, Cramer’s V <0.001
barley 25 (32) 25 (32) 24 (33)
barley+lupins 27 (34) 27 (34) 26 (36)
lupins 27 (34) 27 (34) 22 (31)