Creates data frame with all data types (including NA types) that are possible from a model.
Arguments
- model
A
causal_model
. A model object generated bymake_model
.- complete_data
Logical. If `TRUE` returns only complete data types (no NAs). Defaults to `FALSE`.
- possible_data
Logical. If `TRUE` returns only complete data types (no NAs) that are *possible* given model restrictions. Note that in principle an intervention could make observationally impossible data types arise. Defaults to `FALSE`.
- given
A character. A quoted statement that evaluates to logical. Data conditional on specific values.
See also
Other data_generation:
data_helpers
,
make_data_single()
,
observe_data()
Examples
# \donttest{
make_model('X -> Y') |> get_all_data_types()
#> event X Y
#> X0Y0 X0Y0 0 0
#> X1Y0 X1Y0 1 0
#> X0Y1 X0Y1 0 1
#> X1Y1 X1Y1 1 1
#> Y0 Y0 NA 0
#> Y1 Y1 NA 1
#> X0 X0 0 NA
#> X1 X1 1 NA
#> None None NA NA
model <- make_model('X -> Y') |>
set_restrictions(labels = list(Y = '00'), keep = TRUE)
get_all_data_types(model)
#> event X Y
#> X0Y0 X0Y0 0 0
#> X1Y0 X1Y0 1 0
#> X0Y1 X0Y1 0 1
#> X1Y1 X1Y1 1 1
#> Y0 Y0 NA 0
#> Y1 Y1 NA 1
#> X0 X0 0 NA
#> X1 X1 1 NA
#> None None NA NA
get_all_data_types(model, complete_data = TRUE)
#> event X Y
#> X0Y0 X0Y0 0 0
#> X1Y0 X1Y0 1 0
#> X0Y1 X0Y1 0 1
#> X1Y1 X1Y1 1 1
get_all_data_types(model, possible_data = TRUE)
#> event X Y
#> X0Y0 X0Y0 0 0
#> X1Y0 X1Y0 1 0
get_all_data_types(model, given = 'X==1')
#> event X Y
#> X1Y0 X1Y0 1 0
#> X1Y1 X1Y1 1 1
#> X1 X1 1 NA
get_all_data_types(model, given = 'X==1 & Y==1')
#> event X Y
#> X1Y1 X1Y1 1 1
# }