probmat2amat | R Documentation |
Convert a matrix of probabilities into an adjacency matrix
probmat2amat( probmat, threshold, method = "cutoff", keep_vnames = TRUE, graph_criterion = "pdag", deletesym = FALSE )
probmat |
Square matrix of probabilities. |
threshold |
Value between 0 and 1. Any probabilities lower than this value will be set to 0 (no arrowhead). |
method |
Either |
keep_vnames |
If |
graph_criterion |
Which criterion to check if the output graph fulfills for the bpco
method. Should be one of |
deletesym |
If |
Two methods for converting the probability matrix into an adjacency
matrix are implemented. First, the cutoff-method (method = "cutoff"
) simply
uses a threshold value and sets all values below that to zero in the outputted
adjacency matrix. No checks are performed to ensure that the resulting
matrix is a proper dag/pdag/cpdag adjacency matrix. Second, the backwards
PC orientation method (method = "bpco"
) first uses a cutoff, and then
sets further elements to zero until the resulting matrix can be converted into
a proper adjacency matrix (using the graph criterion specified in the
graph_criterion
argument) by applying the PC algorithm orientation rules.
See Petersen et al. 2022 for further details.
A square matrix of probabilities (all entries in [0,1]).
Petersen, Anne Helby, et al. "Causal discovery for observational sciences using supervised machine learning." arXiv preprint arXiv:2202.12813 (2022).
#Make random probability matrix that can be #converted into adjancency matrix pmat <- matrix(runif(25, 0, 1), 5, 5) diag(pmat) <- 0 #Convert to adjacency matrix using cutoff-method (threshold = 0.5) probmat2amat(pmat, threshold = 0.5) #Convert to adjacency matrix using BPCO-method (threshold = 0.5) probmat2amat(pmat, threshold = 0.5, method = "bpco")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.