Skip to contents

Add interaction

Usage

add_interaction(list_var, between_var, sd = 0, mu = 0)

Arguments

list_var

A list of variables (already initialized)

between_var

A vector of variable names to include in the interaction

sd

Either numeric value or NA. Use to specify range of effect sizes. Default 0 for no interaction effects.

mu

Either a numeric value or a numeric vector (of length = level). Default : 0. Not recommended to modify.

Value

A list with initialized interaction

Examples

init_variable(name = "myvarA", sd = 3, level = 200) %>%
init_variable(name = "myvarB", sd = 0.2, level = 2 ) %>%
add_interaction(between_var = c("myvarA", "myvarB"), sd = 2)
#> Variable name should not contain digits, spaces, or special characters.
#> If any of these are present, they will be removed from the variable name.
#> Variable name should not contain digits, spaces, or special characters.
#> If any of these are present, they will be removed from the variable name.
#> $myvarA
#>   mu sd level
#> 1  0  3   200
#> 
#> $myvarB
#>   mu  sd level
#> 1  0 0.2     2
#> 
#> $interactions
#> $interactions$`myvarA:myvarB`
#>   mu sd level
#> 1  0  2   400
#> 
#>