litter_var_explained_by_treat: Between-litter variance explained by the treatment effect

Description Usage Arguments Details Examples

Description

This function computes the between_litter variance explained by the treatment effect. Note that treatment does not necessarily reflect and experimental design. In this context, the treatment is a comparison between two groups (e.g., high vs low lg).

Usage

1
litter_var_explained_by_treat(outcome, treatment, litter)

Arguments

outcome

the observations to be predicted

treatment

predictor (two groups: high vs low LG)

litter

litter variable (see my_data for example)

Details

Note that, in some instances, the variance explained can be negative. In this case, there is more betweem-litter variance after the inclusion of the treatment effect in the model. This is cannot be interpreted directly, but does indicate that the treatment effect did not explain any of the between-litter variance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# specify values
b_0 <- 5
b_treat <- 2
icc <- 0.5
v_overall <- 10
n_litters <- 12
pups_litter <- 4
my_data <- data_generator(b_0 = b_0, b_treat = b_treat, 
                         icc = icc, v_overall = v_overall, 
                         n_litters = n_litters, 
                         pups_litter = pups_litter)
                   
                   
outcome <- my_data$y
treatment <- my_data$treatment
litter <- my_data$litter
var_explained_by_treat(outcome = outcome, 
                       treatment = treatment, 
                       litter = litter)

donaldRwilliams/litterEffects documentation built on May 30, 2019, 9:42 p.m.