Learn R Programming

SIN (version 0.4)

getgraph: Obtain graph from simultaneous p-values

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

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 e
blocks
a list of integer vectors specifying a family of subsets of the variables.

Value

  • The function returns an adjacency matrix $A$ with $A_{ij}=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_{ij}=A_{ji}=1$, $i\to j$ if and only if $A_{ij}=1$ and $A_{ji}=0$, and $i\leftrightarrow j$ if and only if $A_{ij}=A_{ji}=2$.

Examples

Run this code
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)

Run the code above in your browser using DataLab