Learn R Programming

MRPC (version 2.2.0)

CompareMethodsNodeOrdering: Comparison of inference accuracy using the same data but with different node orderings.

Description

Investigate the performance of five methods on the same data but with different node orderings: MRPC (Badsha and Fu, 2019; Badsha et al., 2018), pc, implemented in pcalg (Kalisch et al., 2012), and pc.stable, mmpc, and mmhc, the last three all implemented in bnlearn (Scutari, 2010). See details in Badsha et al., 2018.

Usage

CompareMethodsNodeOrdering(N, model, signal, n_data, n_nodeordering)

Arguments

N

The number of observations.

model

Either 'truth1' or 'truth2' to specify the model to generate data from.

signal

The signal strength which is the coefficient of the parent nodes in the linear model.

n_data

The number of independent data sets to generate.

n_nodeordering

The number of times to reorder the nodes.

Value

Matrix

Details

The code runs a method on a data set, derives a vector of the differences between the inferred and the true adjacency matrix, and converts the difference vector into a decimal. A decimal of 0 indicates perfect recovery of the truth. Decimals such as 446 and -2214 indicate two different inferred graphs, both different from the truth.

The output is a matrix where the columns indicate which method and which node ordering (e.g., the columns may be 'MRPC_NO1', 'MRPC_NO2', 'PC_NO1', 'mmhc_NO6' and so on), and each row contains the decimals from differents methods for one simulated data set under different node orderings.

References

1. Badsha MB and Fu AQ (2019). Learning causal biological networks with the principle of Mendelian randomization. Frontiers in Genetics, 10(460).

2. Badsha MB, Martin EA and Fu AQ (2018). MRPC: An R package for accurate inference of causal graphs. arXiv:1806.01899.

3. Kalisch M, Machler M, Colombo D, Maathuis MH and Buhlmann P (2012). Causal Inference Using Graphical Models with the R Package pcalg. Journal of Statistical Software, 47, 26.

4. Scutari M (2010). Learning Bayesian Networks with the bnlearn R Package. Journal of Statistical Software, 35(3), 1-22.

Examples

Run this code
# NOT RUN {
# We will generate 2 different data sets from truth1 (V1-->T1-->T2-->T3) 
# with signal = 1, N = 100 and 6 different node orderings. Therefore, we will 
# get 2 by 30 output matrix, where the first and second rows are for data sets 1 and 2 respectively.
# Columns 1:6, 7:12, 13:18, 19:24 and 25:30 are for MRPC, pc, pc.stable, mmpc and
# mmhc respectively with node order 1, 2, ..., 6.

library(MRPC)    #  MRPC
library(pcalg)   #  pc
library(bnlearn) #  pc.stable, mmpc, and mmhc

# Run
Output <- CompareMethodsNodeOrdering(N = 100, 
                                    'truth1',
                                     signal = 1, 
                                     n_data = 2,
                                     n_nodeordering = 6)
# }

Run the code above in your browser using DataLab