Learn R Programming

CausalQueries (version 1.0.2)

make_parmap: Make parmap: a matrix mapping from parameters to data types

Description

Generates a matrix with a row per parameter and a column per data type.

Usage

make_parmap(model, A = NULL, P = NULL)

Value

A matrix

Arguments

model

A causal_model. A model object generated by make_model.

A

A data.frame. Ambiguity matrix. Not required but may be provided to avoid repeated computation for simulations.

P

A data.frame. Parameter matrix. Not required but may be provided to avoid repeated computation for simulations.

Examples

Run this code
make_parmap(model = make_model('X->Y'))
make_parmap(model = make_model('X->Y; X<->Y'))
make_parmap(model = make_model('X->Y; X<->Y')) |> attr("map")
make_parmap(model = make_model('X -> M -> Y; X <-> Y'))
make_parmap(model = make_model('X -> M -> Y; M <-> Y'))
model <- make_model('X -> M -> Y; M <-> Y; X <-> M')
make_parmap(model)
make_parmap(model) |> attr("map")
# Any ways (without paths splits)
make_parmap(model) %*% (make_parmap(model) |> attr("map"))

if (FALSE) {
# X1 and X2 are confounded and jointly determine Y1, Y2.
# For instance for models in which X and Y take on four values rather than 2.
model <- make_model("Y2 <- X1 -> Y1; Y2 <- X2 ->Y1; X1 <-> X2; Y1 <-> Y2")
parmap <- make_parmap(model)
parmap |> dim()

CausalQueries:::prep_stan_data(
  model,
  CausalQueries:::minimal_event_data(model))$n_params
}

Run the code above in your browser using DataLab