Obtains an undirected graph from a matrix of pairwise measurements

1 2 | ```
qpAnyGraph(measurementsMatrix, threshold=NA_real_, remove=c("below", "above"),
topPairs=NA_integer_, decreasing=TRUE, pairup.i=NULL, pairup.j=NULL)
``` |

`measurementsMatrix` |
matrix of pairwise measurements. |

`threshold` |
threshold on the measurements below or above which pairs of variables are assumed to be disconnected in the resulting graph. |

`remove` |
direction of the removal with the threshold. It should be
either |

`topPairs` |
number of edges from the top of the ranking, defined by the
pairwise measurements in |

`decreasing` |
logical, only applies when topPairs is set; if |

`pairup.i` |
subset of vertices to pair up with subset |

`pairup.j` |
subset of vertices to pair up with subset |

This is a general purpose function for thresholding a matrix of pairwise measurements to select pairs of variables corresponding to selected edges in an undirected graph.

The resulting undirected graph as a `graphBAM`

object.
Note that when some gold-standard graph is available for comparison,
a value for the parameter `threshold`

can be found by calculating a
precision-recall curve with `qpPrecisionRecall`

with respect to this
gold-standard, and then using `qpPRscoreThreshold`

. Parameters
`threshold`

and `topPairs`

are mutually exclusive, that is, when
we specify with `topPairs=n`

that we want a graph with `n`

edges
then `threshold`

cannot be used.

R. Castelo and A. Roverato

Castelo, R. and Roverato, A. A robust procedure for
Gaussian graphical model search from microarray data with p larger than n,
*J. Mach. Learn. Res.*, 7:2621-2650, 2006.

`qpNrr`

`qpAvgNrr`

`qpEdgeNrr`

`qpGraph`

`qpGraphDensity`

`qpClique`

`qpPrecisionRecall`

`qpPRscoreThreshold`

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 | ```
require(mvtnorm)
require(graph)
nVar <- 50 ## number of variables
maxCon <- 5 ## maximum connectivity per variable
nObs <- 30 ## number of observations to simulate
set.seed(123)
A <- qpRndGraph(p=nVar, d=maxCon)
Sigma <- qpG2Sigma(A, rho=0.5)
X <- rmvnorm(nObs, sigma=as.matrix(Sigma))
## estimate Pearson correlations
pcc.estimates <- qpPCC(X)
## the higher the threshold
g <- qpAnyGraph(abs(pcc.estimates$R), threshold=0.9,
remove="below")
## the sparser the qp-graph
numEdges(g) / choose(numNodes(g), 2)
## the lower the threshold
g <- qpAnyGraph(abs(pcc.estimates$R), threshold=0.5,
remove="below")
# the denser the graph
numEdges(g) / choose(numNodes(g), 2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.