Learn R Programming

CausalQueries (version 1.3.3)

set_parameter_matrix: Set parameter matrix

Description

Add a parameter matrix to a model

Usage

set_parameter_matrix(model, P = NULL)

Value

An object of class causal_model. It essentially returns a list containing the elements comprising a model (e.g. 'statement', 'nodal_types' and 'DAG') with the parameter matrix attached to it.

Arguments

model

A causal_model. A model object generated by make_model.

P

A data.frame. Parameter matrix. Not required but may be provided to avoid repeated computation for simulations. See inspect(model, "parameter_matrix").

Examples

Run this code
model <- make_model('X -> Y')
P <- diag(8)
colnames(P) <- inspect(model, "causal_types") |> rownames()
model <- set_parameter_matrix(model, P = P)

Run the code above in your browser using DataLab