pc_parallel: Estimate the Equivalence Class of a DAG using the PC_parallel...

Description Usage Arguments Value Examples

Description

Estimate the equivalence class of a directed acyclic graph (DAG) from observational data, using the PC_parallel algorithm.

Usage

1
2
3
4
5
pc_parallel(suffStat, indepTest, alpha, labels, p, fixedGaps = NULL,
  fixedEdges = NULL, NAdelete = TRUE, m.max = Inf, u2pd = c("relaxed",
  "rand", "retry"), skel.method = c("parallel"), mem.efficient = FALSE,
  conservative = FALSE, maj.rule = FALSE, solve.confl = FALSE,
  verbose = FALSE, num.cores = detectCores())

Arguments

suffStat

A list of sufficient statistics, containing all necessary elements for the conditional independence decisions in the function indepTest.

indepTest

A function for testing conditional independence. It is internally called as indepTest(x,y,S,suffStat), and tests conditional independence of x and y given S. Here, x and y are variables, and S is a (possibly empty) vector of variables (all variables are denoted by their column numbers in the adjacency matrix). suffStat is a list, see the argument above. The return value of indepTest is the p-value of the test for conditional independence.

alpha

significance level (number in (0,1) for the individual conditional independence tests.

labels

(optional) character vector of variable (or "node") names. Typically preferred to specifying p.

p

(optional) number of variables (or nodes). May be specified if labels are not, in which case labels is set to 1:p.

fixedGaps

A logical matrix of dimension p*p. If entry [i,j] or [j,i] (or both) are TRUE, the edge i-j is removed before starting the algorithm. Therefore, this edge is guaranteed to be absent in the resulting graph.

fixedEdges

A logical matrix of dimension p*p. If entry [i,j] or [j,i] (or both) are TRUE, the edge i-j is never considered for removal. Therefore, this edge is guaranteed to be present in the resulting graph.

NAdelete

If indepTest returns NA and this option is TRUE, the corresponding edge is deleted. If this option is FALSE, the edge is not deleted.

m.max

Maximal size of the conditioning sets that are considered in the conditional independence tests.

u2pd

String specifying the method for dealing with conflicting information when trying to orient edges (see pcalg for details).

skel.method

Character string specifying method; the default, "parallel", skeleton_parallel for learning the causal structure.

mem.efficient

If TRUE, uses less amount of memory at any time point while running the algorithm.

conservative

Logical indicating if the conservative PC is used. In this case, only option u2pd = "relaxed" is supported. Note that therefore the resulting object might not be extendable to a DAG. See pcalg for details.

maj.rule

Logical indicating that the triples shall be checked for ambiguity using a majority rule idea, which is less strict than the conservative PC algorithm. For more information, see pcalg.

solve.confl

If TRUE, the orientation of the v-structures and the orientation rules work with lists for candidate sets and allow bi-directed edges to resolve conflicting edge orientations.See pcalg for details.

verbose

If TRUE, detailed output is provided.

num.cores

The numbers of cores CPU to run the algorithm.

Value

An object of class "pcAlgo" (see pcAlgo in the pcalg package) containing an estimate of the equivalence class of the underlying DAG.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##########################################
## Using pc_parallel without mem.efficeient
##########################################
library(pcalg)
library(parallel)
data("gmG")
p<-ncol(gmG$x)
suffStat<-list(C=cor(gmG$x),n=nrow(gmG$x))
pc_parallel(suffStat, indepTest=gaussCItest, p=p, skel.method="parallel", alpha=0.01, num.cores=2)

##########################################
## Using pc_parallel with mem.efficeient
##########################################
library(pcalg)
library(parallel)
data("gmG")
p<-ncol(gmG$x)
suffStat<-list(C=cor(gmG$x),n=nrow(gmG$x))
pc_parallel(suffStat, indepTest=gaussCItest, p=p, skel.method="parallel",
alpha=0.01, num.cores=2, mem.efficient=TRUE)

#################################################
## Using pc_parallel with mutual information test
#################################################
library(pcalg)
library(parallel)
data("gmG")
p<-ncol(gmG$x)
#The first parameter is the dataset rather than suffStat
pc_parallel(gmG$x, indepTest=mig, p=p, skel.method="parallel",
alpha=0.01, num.cores=2, mem.efficient=TRUE)

Example output

n=5000,p=8
Num CI Tests= 49 136 54 0 ,Total CI Tests= 239 ,Total Time= 0.172 
Object of class 'pcAlgo', from Call:
pc_parallel(suffStat = suffStat, indepTest = gaussCItest, alpha = 0.01, 
    p = p, skel.method = "parallel", num.cores = 2)
Number of undirected edges:  3 
Number of directed edges:    5 
Total number of edges:       8 
sh: 1: egrep: Permission denied
n=5000,p=8
Num CI Tests= 49 136 54 0 ,Total CI Tests= 239 ,Total Time= 0.021 
Object of class 'pcAlgo', from Call:
pc_parallel(suffStat = suffStat, indepTest = gaussCItest, alpha = 0.01, 
    p = p, skel.method = "parallel", mem.efficient = TRUE, num.cores = 2)
Number of undirected edges:  3 
Number of directed edges:    5 
Total number of edges:       8 
sh: 1: egrep: Permission denied
x= 1  y= 2  S=  pvalue= 5.099938e-92 
x= 1  y= 3  S=  pvalue= 7.371696e-05 
x= 1  y= 4  S=  pvalue= 0.4709142 
x= 1  y= 5  S=  pvalue= 1.590519e-40 
x= 1  y= 6  S=  pvalue= 2.464368e-229 
x= 1  y= 7  S=  pvalue= 3.05301e-62 
x= 1  y= 8  S=  pvalue= 1.853518e-95 
x= 2  y= 3  S=  pvalue= 1.380271e-49 
x= 2  y= 4  S=  pvalue= 0.8441614 
x= 2  y= 5  S=  pvalue= 0 
x= 2  y= 6  S=  pvalue= 0 
x= 2  y= 7  S=  pvalue= 9.128529e-86 
x= 2  y= 8  S=  pvalue= 2.865437e-50 
x= 3  y= 4  S=  pvalue= 0.621089 
x= 3  y= 5  S=  pvalue= 1.44078e-15 
x= 3  y= 6  S=  pvalue= 3.870218e-13 
x= 3  y= 7  S=  pvalue= 0.0005116869 
x= 3  y= 8  S=  pvalue= 0.0003247514 
x= 4  y= 5  S=  pvalue= 0.9310067 
x= 4  y= 6  S=  pvalue= 0.9161695 
x= 4  y= 7  S=  pvalue= 0.1822928 
x= 4  y= 8  S=  pvalue= 0.3582551 
x= 5  y= 6  S=  pvalue= 0 
x= 5  y= 7  S=  pvalue= 3.105359e-187 
x= 5  y= 8  S=  pvalue= 4.999357e-98 
x= 6  y= 7  S=  pvalue= 0 
x= 6  y= 8  S=  pvalue= 1.822153e-92 
x= 7  y= 8  S=  pvalue= 1.05601e-28 
x= 1  y= 2  S= 3 pvalue= 1.321568e-88 
x= 1  y= 2  S= 5 pvalue= 1.209295e-53 
x= 1  y= 2  S= 6 pvalue= 2.309143e-08 
x= 1  y= 2  S= 7 pvalue= 5.573205e-63 
x= 1  y= 2  S= 8 pvalue= 8.150879e-65 
x= 2  y= 1  S= 3 pvalue= 1.321568e-88 
x= 2  y= 1  S= 5 pvalue= 1.209295e-53 
x= 2  y= 1  S= 6 pvalue= 2.309143e-08 
x= 2  y= 1  S= 7 pvalue= 5.573205e-63 
x= 2  y= 1  S= 8 pvalue= 8.150879e-65 
x= 1  y= 3  S= 2 pvalue= 0.85904 
x= 1  y= 5  S= 2 pvalue= 0.2263078 
x= 1  y= 6  S= 2 pvalue= 3.953343e-146 
x= 1  y= 6  S= 3 pvalue= 4.235056e-226 
x= 1  y= 6  S= 5 pvalue= 2.19399e-254 
x= 1  y= 6  S= 7 pvalue= 4.156775e-169 
x= 1  y= 6  S= 8 pvalue= 6.345082e-176 
x= 6  y= 1  S= 2 pvalue= 3.953343e-146 
x= 6  y= 1  S= 3 pvalue= 4.235056e-226 
x= 6  y= 1  S= 5 pvalue= 2.19399e-254 
x= 6  y= 1  S= 7 pvalue= 4.156775e-169 
x= 6  y= 1  S= 8 pvalue= 6.345082e-176 
x= 1  y= 7  S= 2 pvalue= 3.80489e-33 
x= 1  y= 7  S= 3 pvalue= 4.064354e-61 
x= 1  y= 7  S= 5 pvalue= 7.10978e-36 
x= 1  y= 7  S= 6 pvalue= 0.6926641 
x= 1  y= 8  S= 2 pvalue= 2.939345e-68 
x= 1  y= 8  S= 3 pvalue= 4.412656e-94 
x= 1  y= 8  S= 5 pvalue= 1.006782e-70 
x= 1  y= 8  S= 6 pvalue= 6.360613e-42 
x= 1  y= 8  S= 7 pvalue= 1.139049e-78 
x= 8  y= 1  S= 2 pvalue= 2.939345e-68 
x= 8  y= 1  S= 3 pvalue= 4.412656e-94 
x= 8  y= 1  S= 5 pvalue= 1.006782e-70 
x= 8  y= 1  S= 6 pvalue= 6.360613e-42 
x= 8  y= 1  S= 7 pvalue= 1.139049e-78 
x= 2  y= 3  S= 1 pvalue= 3.640121e-46 
x= 2  y= 3  S= 5 pvalue= 4.170028e-36 
x= 2  y= 3  S= 6 pvalue= 4.289193e-38 
x= 2  y= 3  S= 7 pvalue= 5.109673e-47 
x= 2  y= 3  S= 8 pvalue= 7.758879e-47 
x= 3  y= 2  S= 1 pvalue= 3.640121e-46 
x= 3  y= 2  S= 5 pvalue= 4.170028e-36 
x= 3  y= 2  S= 6 pvalue= 4.289193e-38 
x= 3  y= 2  S= 7 pvalue= 5.109673e-47 
x= 3  y= 2  S= 8 pvalue= 7.758879e-47 
x= 2  y= 5  S= 1 pvalue= 0 
x= 2  y= 5  S= 3 pvalue= 0 
x= 2  y= 5  S= 6 pvalue= 1.103289e-205 
x= 2  y= 5  S= 7 pvalue= 0 
x= 2  y= 5  S= 8 pvalue= 0 
x= 5  y= 2  S= 1 pvalue= 0 
x= 5  y= 2  S= 3 pvalue= 0 
x= 5  y= 2  S= 6 pvalue= 1.103289e-205 
x= 5  y= 2  S= 7 pvalue= 0 
x= 5  y= 2  S= 8 pvalue= 0 
x= 2  y= 6  S= 1 pvalue= 2.25031e-243 
x= 2  y= 6  S= 3 pvalue= 4.194234e-315 
x= 2  y= 6  S= 5 pvalue= 5.855846e-09 
x= 2  y= 6  S= 7 pvalue= 7.17794e-243 
x= 2  y= 6  S= 8 pvalue= 5.533537e-285 
x= 6  y= 2  S= 1 pvalue= 2.25031e-243 
x= 6  y= 2  S= 3 pvalue= 4.194234e-315 
x= 6  y= 2  S= 5 pvalue= 5.855846e-09 
x= 6  y= 2  S= 7 pvalue= 7.17794e-243 
x= 6  y= 2  S= 8 pvalue= 5.533537e-285 
x= 2  y= 7  S= 1 pvalue= 1.015498e-56 
x= 2  y= 7  S= 3 pvalue= 3.339291e-83 
x= 2  y= 7  S= 5 pvalue= 0.005888501 
x= 2  y= 7  S= 6 pvalue= 0.6766767 
x= 2  y= 8  S= 1 pvalue= 5.755752e-23 
x= 2  y= 8  S= 3 pvalue= 1.610061e-47 
x= 2  y= 8  S= 5 pvalue= 0.00615515 
x= 2  y= 8  S= 6 pvalue= 2.543626e-08 
x= 2  y= 8  S= 7 pvalue= 1.482252e-35 
x= 8  y= 2  S= 1 pvalue= 5.755752e-23 
x= 8  y= 2  S= 3 pvalue= 1.610061e-47 
x= 8  y= 2  S= 5 pvalue= 0.00615515 
x= 8  y= 2  S= 6 pvalue= 2.543626e-08 
x= 8  y= 2  S= 7 pvalue= 1.482252e-35 
x= 3  y= 5  S= 1 pvalue= 1.612973e-13 
x= 3  y= 5  S= 2 pvalue= 0.1615164 
x= 3  y= 6  S= 1 pvalue= 7.743022e-10 
x= 3  y= 6  S= 2 pvalue= 0.8139351 
x= 3  y= 7  S= 1 pvalue= 0.008553243 
x= 3  y= 7  S= 2 pvalue= 0.5843559 
x= 3  y= 8  S= 1 pvalue= 0.01021647 
x= 5  y= 6  S= 1 pvalue= 0 
x= 5  y= 6  S= 2 pvalue= 0 
x= 5  y= 6  S= 3 pvalue= 0 
x= 5  y= 6  S= 7 pvalue= 0 
x= 5  y= 6  S= 8 pvalue= 0 
x= 6  y= 5  S= 1 pvalue= 0 
x= 6  y= 5  S= 2 pvalue= 0 
x= 6  y= 5  S= 3 pvalue= 0 
x= 6  y= 5  S= 7 pvalue= 0 
x= 6  y= 5  S= 8 pvalue= 0 
x= 5  y= 7  S= 1 pvalue= 5.877785e-161 
x= 5  y= 7  S= 2 pvalue= 4.165151e-105 
x= 5  y= 7  S= 3 pvalue= 1.22854e-184 
x= 5  y= 7  S= 6 pvalue= 0.05279372 
x= 5  y= 8  S= 1 pvalue= 2.702706e-73 
x= 5  y= 8  S= 2 pvalue= 3.037531e-51 
x= 5  y= 8  S= 3 pvalue= 1.309775e-95 
x= 5  y= 8  S= 6 pvalue= 2.321312e-18 
x= 5  y= 8  S= 7 pvalue= 1.602932e-73 
x= 8  y= 5  S= 1 pvalue= 2.702706e-73 
x= 8  y= 5  S= 2 pvalue= 3.037531e-51 
x= 8  y= 5  S= 3 pvalue= 1.309775e-95 
x= 8  y= 5  S= 6 pvalue= 2.321312e-18 
x= 8  y= 5  S= 7 pvalue= 1.602932e-73 
x= 6  y= 7  S= 1 pvalue= 4.940656e-324 
x= 6  y= 7  S= 2 pvalue= 2.139253e-300 
x= 6  y= 7  S= 3 pvalue= 0 
x= 6  y= 7  S= 5 pvalue= 8.697961e-200 
x= 6  y= 7  S= 8 pvalue= 0 
x= 7  y= 6  S= 1 pvalue= 4.940656e-324 
x= 7  y= 6  S= 2 pvalue= 2.139253e-300 
x= 7  y= 6  S= 3 pvalue= 0 
x= 7  y= 6  S= 5 pvalue= 8.697961e-200 
x= 7  y= 6  S= 8 pvalue= 0 
x= 6  y= 8  S= 1 pvalue= 6.393431e-39 
x= 6  y= 8  S= 2 pvalue= 8.417564e-51 
x= 6  y= 8  S= 3 pvalue= 3.172683e-90 
x= 6  y= 8  S= 5 pvalue= 1.00067e-12 
x= 6  y= 8  S= 7 pvalue= 1.431344e-65 
x= 8  y= 6  S= 1 pvalue= 6.393431e-39 
x= 8  y= 6  S= 2 pvalue= 8.417564e-51 
x= 8  y= 6  S= 3 pvalue= 3.172683e-90 
x= 8  y= 6  S= 5 pvalue= 1.00067e-12 
x= 8  y= 6  S= 7 pvalue= 1.431344e-65 
x= 7  y= 8  S= 1 pvalue= 9.474133e-12 
x= 7  y= 8  S= 2 pvalue= 6.715139e-14 
x= 7  y= 8  S= 3 pvalue= 5.729639e-28 
x= 7  y= 8  S= 5 pvalue= 0.0009160009 
x= 7  y= 8  S= 6 pvalue= 0.8317772 
x= 1  y= 2  S= 6 8 pvalue= 3.758175e-06 
x= 2  y= 1  S= 3 5 pvalue= 3.015826e-52 
x= 2  y= 1  S= 3 6 pvalue= 3.520921e-08 
x= 2  y= 1  S= 3 8 pvalue= 8.588864e-63 
x= 2  y= 1  S= 5 6 pvalue= 1.2823e-46 
x= 2  y= 1  S= 5 8 pvalue= 2.87572e-52 
x= 2  y= 1  S= 6 8 pvalue= 3.758175e-06 
x= 1  y= 6  S= 2 8 pvalue= 1.013612e-117 
x= 6  y= 1  S= 2 5 pvalue= 2.195145e-247 
x= 6  y= 1  S= 2 7 pvalue= 7.258403e-115 
x= 6  y= 1  S= 2 8 pvalue= 1.013612e-117 
x= 6  y= 1  S= 5 7 pvalue= 1.423809e-220 
x= 6  y= 1  S= 5 8 pvalue= 1.507863e-243 
x= 6  y= 1  S= 7 8 pvalue= 1.863829e-132 
x= 1  y= 8  S= 2 6 pvalue= 8.914333e-40 
x= 8  y= 1  S= 2 5 pvalue= 2.386207e-69 
x= 8  y= 1  S= 2 6 pvalue= 8.914333e-40 
x= 8  y= 1  S= 5 6 pvalue= 7.371653e-60 
x= 2  y= 3  S= 1 5 pvalue= 1.047225e-34 
x= 2  y= 3  S= 1 6 pvalue= 6.474308e-38 
x= 2  y= 3  S= 1 8 pvalue= 8.229599e-45 
x= 2  y= 3  S= 5 6 pvalue= 1.710511e-35 
x= 2  y= 3  S= 5 8 pvalue= 7.037585e-36 
x= 2  y= 3  S= 6 8 pvalue= 1.320064e-37 
x= 2  y= 5  S= 1 3 pvalue= 0 
x= 2  y= 5  S= 1 6 pvalue= 1.408165e-243 
x= 2  y= 5  S= 1 8 pvalue= 0 
x= 2  y= 5  S= 3 6 pvalue= 4.268734e-203 
x= 2  y= 5  S= 3 8 pvalue= 0 
x= 2  y= 5  S= 6 8 pvalue= 5.77252e-200 
x= 5  y= 2  S= 6 8 pvalue= 5.77252e-200 
x= 2  y= 6  S= 1 3 pvalue= 3.678652e-235 
x= 2  y= 6  S= 1 5 pvalue= 0.1958793 
x= 2  y= 8  S= 1 3 pvalue= 1.323478e-21 
x= 2  y= 8  S= 1 5 pvalue= 0.2746674 
x= 5  y= 6  S= 2 8 pvalue= 0 
x= 6  y= 5  S= 1 2 pvalue= 0 
x= 6  y= 5  S= 1 7 pvalue= 0 
x= 6  y= 5  S= 1 8 pvalue= 0 
x= 6  y= 5  S= 2 7 pvalue= 0 
x= 6  y= 5  S= 2 8 pvalue= 0 
x= 6  y= 5  S= 7 8 pvalue= 0 
x= 5  y= 8  S= 2 6 pvalue= 1.469385e-12 
x= 8  y= 5  S= 1 2 pvalue= 2.459187e-52 
x= 8  y= 5  S= 1 6 pvalue= 2.256591e-36 
x= 8  y= 5  S= 2 6 pvalue= 1.469385e-12 
x= 6  y= 7  S= 1 2 pvalue= 3.67463e-269 
x= 6  y= 7  S= 1 5 pvalue= 5.768754e-166 
x= 6  y= 7  S= 1 8 pvalue= 8.624173e-314 
x= 6  y= 7  S= 2 5 pvalue= 3.544571e-198 
x= 6  y= 7  S= 2 8 pvalue= 3.303423e-288 
x= 6  y= 7  S= 5 8 pvalue= 1.921404e-197 
x= 6  y= 8  S= 1 2 pvalue= 2.971586e-22 
x= 6  y= 8  S= 1 5 pvalue= 0.3222402 
n=0.3537908,p=8
Num CI Tests= 49 136 54 0 ,Total CI Tests= 239 ,Total Time= 0.494 
Object of class 'pcAlgo', from Call:
pc_parallel(suffStat = gmG$x, indepTest = mig, alpha = 0.01, 
    p = p, skel.method = "parallel", mem.efficient = TRUE, num.cores = 2)
Number of undirected edges:  3 
Number of directed edges:    5 
Total number of edges:       8 

ParallelPC documentation built on May 2, 2019, 9:14 a.m.