dgm: construct and visualize causal (directed) networks

Description Usage Arguments Details Value Author(s) References Examples

View source: R/dgm.R

Description

A wrapper of fci function in pcalg package. Estimates a simplified Partial Ancestral Graph (PAG) using FCI algorithm.

Usage

1
2
dgm(data, alpha = 1e-05, dtype = "gaussian", community = TRUE,
  betweenness = TRUE, plot = FALSE, levels = NULL)

Arguments

data

A normalized dataframe or matrix with no missing data.

alpha

significance level (number in (0,1)) for the individual conditional independence tests. Defaults to 1e-5.

dtype

Either "guassian" for continuous/ordinal discrete data or "discrete" for discrete/nominal data. (default = "gaussian") See details for more description.

community

A logical value to show if the node communities should be detected and colored in the returned graph. (default = TRUE)

betweenness

A logical value to show if the node betweenness measurements should be computed and returned from the function. (default = TRUE)

plot

A logical value to show if the graph should be plotted. (default = FLASE)

levels

An integer value indicating the maximum number of levels of a categorical variable. To be used to distinguish the categorical variable. Defaults to NULL because it is supposed that data has been preprocessed using data_preproc and the categorical variables are specified. If it is set, first will run data_preproc to specify categorical and continuous variables.

Details

There is no specific distribution needed for the data. The parameter dtype will be used for determining the data type to be provided as the input of the function. However, it is highly recommended to use "guassian" data type for both continuous and ordinal discrete data.

Value

A list in which each element is the details of a specific fitted dtype.

significance

A data.frame containing edges with p.values.

graph

an igraph object of the graphical model.

betweenness

betweenness measurements of each node.

communities

a named vector indicating the community of each node.

network

a visNetwork plot of the graphical model.

Author(s)

Elyas Heidari

References

D. Colombo and M.H. Maathuis (2014).Order-independent constraint-based causal structure learning. Journal of Machine Learning Research 15 3741-3782.

D. Colombo, M. H. Maathuis, M. Kalisch, T. S. Richardson (2012). Learning high-dimensional directed acyclic graphs with latent and selection variables. Ann. Statist. 40, 294-321.

M. Kalisch and P. Buehlmann (2007). Estimating high-dimensional directed acyclic graphs with the PC-algorithm, JMLR 8 613-636.

P. Spirtes, C. Glymour and R. Scheines (2000). Causation, Prediction, and Search, 2nd edition, MIT Press.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data("NHANES")
## Using raw data
## Using "gaussian" method for continuous data
gaussian_dgm <- dgm(data = NHANES[1:1000, ], dtype = "gaussian", levels = 10)

## Using "discrete" method for categorical data
discrete_dgm <- dgm(data = NHANES[1000:1200, ], dtype = "discrete", levels = 5)

## Using preprocessed data
data <- data_preproc(NHANES, levels = 15)
data$SEQN <- NULL
prep_gauss_dgm <- dgm(data = data[1:1000, ], plot = TRUE)

bAIo-lab/Questools documentation built on Nov. 9, 2019, 3:59 a.m.