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

View source: R/parmap.R

make_parmapR Documentation

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)

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.

Value

A matrix

Examples

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"))

## Not run: 
# 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")
data <- CausalQueries:::minimal_event_data(model)
check <- CausalQueries:::prep_stan_data(model, data, keep_transformed = TRUE)
check$n_params
a <- update_model(model)
make_parmap(model) %>% dim

## End(Not run)

CausalQueries documentation built on Oct. 20, 2023, 1:06 a.m.