getgraph: Obtain graph from simultaneous p-values

Description Usage Arguments Value Examples

View source: R/sinhelpfunctions.R

Description

This function converts a matrix of simultaneous p-values into a graph by comparing the p-values to a user-provided significance level.

Usage

1
getgraph(pvals, alpha, type="UG", blocks=NULL)

Arguments

pvals

a matrix of simultaneous p-values.

alpha

a significance level, i.e., alpha in (0,1).

type

a string specifying the type of graph that should be obtained from the p-value matrix. If type equals "UG" then an undirected graph is returned, if type equals "DAG" then an acyclic directed graph is returned, and if type equals "BG" then a bidirected graph is returned. If type equals the fourth possible choice "CG" then a chain graph is returned, in which case a list of integer vectors has to be provided as the input blocks.

blocks

a list of integer vectors specifying a family of subsets of the variables.

Value

The function returns an adjacency matrix A with A[i,j]=0 if there is no edge between vertices (variables) i and j. The convention for edges is that i-j if and only if A[i,j]=A[j,i]=1, i->j if and only if A[i,j]=1 and A[j,i]=0, and i<->j if and only if A[i,j]=A[j,i]=2.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(fowlbones)
pvals <- sinUG(fowlbones$corr,fowlbones$n)
alpha <- 0.2
## get undirected graph
getgraph(pvals, alpha, type="UG") 
## forget that we used sinUG and get acyclic directed graph
getgraph(pvals, alpha, type="DAG")
## forget that we used sinUG and get bidirected graph
getgraph(pvals, alpha, type="BG")
## forget that we used sinUG and get chain graph
myblocks <- list(1:2,3:4,5:6)
getgraph(pvals, alpha, type="CG", blocks=myblocks)

SIN documentation built on May 2, 2019, 8:23 a.m.

Related to getgraph in SIN...