Learn R Programming

ParallelPC (version 1.2)

pcSelect_parallel: Estimate subgraph around a response variable using pcSelect_parallel.

Description

This is the parallelised version of the pcSelect (stable) function in the pcalg package. Assume that we have a fixed target variable, the algorithm will test the dependency between each variable and the target variable conditioning on combinations of other variables.

Usage

pcSelect_parallel(y, dm, method = c("parallel"), mem.efficient = FALSE, num_workers, alpha, corMethod = "standard", verbose = FALSE, directed = FALSE)

Arguments

y
The target (response) variable.
dm
Data matrix with rows are samples and columns are variables.
method
Character string specifying method; the default, "parallel" provides an parallelised method to implement all the conditional independence tests.
mem.efficient
If TRUE, uses less amount of memory at any time point while running the algorithm
num_workers
The numbers of cores CPU to run the algorithm
alpha
Significance level of individual partial correlation tests.
corMethod
"standard" or "Qn" for standard or robust correlation estimation
verbose
Logical or in {0,1,2};

FALSE, 0: No output,

TRUE, 1: Little output,

2: Detailed output.

Note that such output makes the function very much slower.

directed
Logical; should the output graph be directed?

Value

G A logical vector indicating which column of dm is associated with y.zMin The minimal z-values when testing partial correlations between y and each column of dm. The larger the number, the more consistent is the edge with the data.

Examples

Run this code
##########################################
## Using pcSelect_parallel without mem.efficeient
##########################################
library(pcalg)
library(parallel)
p <- 10
set.seed(101)
myDAG <- randomDAG(p, prob = 0.2)
n <- 1000
d.mat <- rmvDAG(n, myDAG, errDist = "normal")
pcSelect_parallel(d.mat[,10],d.mat[,-10], alpha=0.05,num_workers=2)

##########################################
## Using pcSelelct_parallel with mem.efficeient
##########################################
library(pcalg)
library(parallel)
p <- 10
set.seed(101)
myDAG <- randomDAG(p, prob = 0.2)
n <- 1000
d.mat <- rmvDAG(n, myDAG, errDist = "normal")
pcSelect_parallel(d.mat[,10],d.mat[,-10], alpha=0.05,mem.efficient=TRUE,num_workers=2)

Run the code above in your browser using DataLab