pgraph: Calculate the Conditional Dependency Graph

Description Usage Arguments Value See Also Examples

View source: R/pgraph.R

Description

pgraph calculate the conditional dependency graph (with/without external factors) via projection using lasso or sparse additive model.

Usage

1
2
3
4
5
6
7
8
9
pgraph(
  z,
  f = NULL,
  method = c("lasso", "sam", "ols"),
  cond = TRUE,
  R = 199,
  randSeed = 0,
  trace = FALSE
)

Arguments

z

n * p dimensional matrix

f

n * q factor matrix. Default = 'NULL'.

method

projection method. Default = 'lasso'.

cond

whether to create a conditional graph or unconditional graph. Default = TRUE. If cond = FALSE, f must be provided.

R

number of random permutations for the test.

randSeed

the random seed for the program. Default = 0.

trace

whether to trace to estimation process.

Value

a list to be used to calculate the ROC curve.

statmat.pearson

matrix with pearson correlation test

statmat.dcov

matrix with distance covariance test

See Also

greg, roc, projcov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(splines)
set.seed(0)
p = 5;
n = 100;
tmp=runif(p-1,1,3)
s=c(0,cumsum(tmp));
s1=matrix(s,p,p)
cov.mat.true=exp(-abs(s1-t(s1)))
prec.mat.true=solve(cov.mat.true);
a=matrix(rnorm(p*n),n,p)
data.sa=a%*%chol(cov.mat.true);
true.graph = outer(1:p,1:p,f<-function(x,y){(abs(x-y)==1)})
methodlist = c('lasso','sam')
fit = vector(mode='list', length=2)
info = vector(mode='list', length=2)
auc = NULL
for(i in 1:2){
method = methodlist[i]
fit[[i]] = pgraph(data.sa, method = method)
info[[i]] = roc(fit[[i]]$statmat.pearson, true.graph)
auc[i] = sum(-diff(info[[i]][,1])*info[[i]][-1,2])
  cat(method, ': auc=', auc[i],'\n')
}

pgraph documentation built on Jan. 21, 2020, 5:07 p.m.

Related to pgraph in pgraph...