Skip to contents

This is a simple dataset with nonlinear relationships between the outcome and mediators. It is used simply to illustrate the design of multimedia. The mediator->outcome effect is generated from a random spline function.

Usage

demo_spline(n_samples = 5000, tau = c(2, 2))

Arguments

n_samples

The number of samples to generate in the toy example

tau

The true direct effects associated with the two outcomes. Defaults to 2, 2.

Value

xy A data.frame whose columns include the treatment, mediation, and outcome variables.

Examples

demo_spline()
#> # A tibble: 5,000 × 4
#>    outcome_1 outcome_2 mediator treatment
#>        <dbl>     <dbl>    <dbl> <fct>    
#>  1   -1.61      -2.07    -3.21  0        
#>  2   -0.0125    -1.43    -4.25  0        
#>  3    0.527      1.01     3.55  0        
#>  4   -0.826     -0.714   -2.69  0        
#>  5    0.0842    -0.378   -3.46  0        
#>  6   -1.25      -1.14    -2.54  0        
#>  7   -0.198     -1.63    -4.23  0        
#>  8   -0.925     -0.730   -2.42  0        
#>  9    0.0409    -1.53    -4.41  0        
#> 10    0.474      0.886    0.864 0        
#> # ℹ 4,990 more rows