Output is a parameter data frame recording both parameters (case level priors) and the case level causal type.
Arguments
- model
A
causal_model
. A model object generated bymake_model
.- ...
Arguments passed to `set_parameters`
Examples
# Simple draw using model's parameter vector
make_model("X -> M -> Y") |>
draw_causal_type()
#> # A tibble: 10 × 9
#> param_names node gen param_set nodal_type given param_value priors
#> <chr> <chr> <int> <chr> <chr> <chr> <dbl> <dbl>
#> 1 X.0 X 1 X 0 "" 0.5 1
#> 2 X.1 X 1 X 1 "" 0.5 1
#> 3 M.00 M 2 M 00 "" 0.25 1
#> 4 M.10 M 2 M 10 "" 0.25 1
#> 5 M.01 M 2 M 01 "" 0.25 1
#> 6 M.11 M 2 M 11 "" 0.25 1
#> 7 Y.00 Y 3 Y 00 "" 0.25 1
#> 8 Y.10 Y 3 Y 10 "" 0.25 1
#> 9 Y.01 Y 3 Y 01 "" 0.25 1
#> 10 Y.11 Y 3 Y 11 "" 0.25 1
#> # ℹ 1 more variable: causal_type <int>
# Draw parameters from priors and draw type from parameters
make_model("X -> M -> Y") |>
draw_causal_type(, param_type = "prior_draw")
#> # A tibble: 10 × 9
#> param_names node gen param_set nodal_type given param_value priors
#> <chr> <chr> <int> <chr> <chr> <chr> <dbl> <dbl>
#> 1 X.0 X 1 X 0 "" 0.355 1
#> 2 X.1 X 1 X 1 "" 0.645 1
#> 3 M.00 M 2 M 00 "" 0.654 1
#> 4 M.10 M 2 M 10 "" 0.204 1
#> 5 M.01 M 2 M 01 "" 0.0204 1
#> 6 M.11 M 2 M 11 "" 0.121 1
#> 7 Y.00 Y 3 Y 00 "" 0.000978 1
#> 8 Y.10 Y 3 Y 10 "" 0.0656 1
#> 9 Y.01 Y 3 Y 01 "" 0.484 1
#> 10 Y.11 Y 3 Y 11 "" 0.450 1
#> # ℹ 1 more variable: causal_type <int>
# Draw type given specified parameters
make_model("X -> M -> Y") |>
draw_causal_type(parameters = 1:10)
#> # A tibble: 10 × 9
#> param_names node gen param_set nodal_type given param_value priors
#> <chr> <chr> <int> <chr> <chr> <chr> <dbl> <dbl>
#> 1 X.0 X 1 X 0 "" 0.333 1
#> 2 X.1 X 1 X 1 "" 0.667 1
#> 3 M.00 M 2 M 00 "" 0.167 1
#> 4 M.10 M 2 M 10 "" 0.222 1
#> 5 M.01 M 2 M 01 "" 0.278 1
#> 6 M.11 M 2 M 11 "" 0.333 1
#> 7 Y.00 Y 3 Y 00 "" 0.206 1
#> 8 Y.10 Y 3 Y 10 "" 0.235 1
#> 9 Y.01 Y 3 Y 01 "" 0.265 1
#> 10 Y.11 Y 3 Y 11 "" 0.294 1
#> # ℹ 1 more variable: causal_type <int>