to_dag: Transform a matrix of causal coefficients to a DAG

View source: R/causalsim.R

to_dagR Documentation

Transform a matrix of causal coefficients to a DAG

Description

A square matrix containing causal coefficients with standard deviation of unique components on the diagonal is transformed into a lower-triangular matrix by permutations of its rows and columns, if possible. Otherwise an error is produced.

Usage

to_dag(mat)

permute_to_dag(mat)

Arguments

mat

a square matrix with variable names for rows and columns. Off-diagonal entries are causal coefficients for the row variable depending on the column variables. The diagonal elements are standard deviations of the the independent component producing variability in the row variable.

Details

See coefx for an extended example.

Value

If the input matrix represents a DAG, the input matrix with permuted rows and columns as a lower diagonal matrix. Thus data from the DAG can be generated by simulating variables in the same order as the row order. If the input matrix cannot define a DAG (i.e. is not acyclic) the function return FALSE with an error message.


gmonette/causalsim documentation built on April 21, 2022, 1:40 a.m.