R: Determine whether a vector is in the closure of the convex...

is.inCH {ergm} | R Documentation

## Determine whether a vector is in the closure of the convex hull of some sample of vectors

### Description

`is.inCH()` returns `TRUE` if and only if `p` is contained in the convex hull of the points given as the rows of `M`. If `p` is a matrix, each row is tested individually, and `TRUE` is returned if all rows are in the convex hull.

`shrink_into_CH()` returns the coefficient by which rows of `p` can be scaled towards or away from point `m` in order for all of them to be in the convex hull of `M` or on its boundary.

### Usage

    is.inCH(p, M, verbose = FALSE, ...)

    shrink_into_CH(
      p,
      M,
      m = NULL,
      verbose = FALSE,
      ...,
      solver = c("glpk", "lpsolve")
    )

### Arguments

`p` | A d-dimensional vector or a matrix with d columns
`M` | An n by d matrix. Each row of `M` is a d-dimensional vector.
`verbose` | A logical or an integer to control the amount of progress and diagnostic information to be printed. `FALSE`/`0` produces minimal output, wit higher values producing more detail. Note that very high values (5+) may significantly slow down processing.
`...` | arguments passed directly to linear program solver
`solver` | A character string selecting which solver to use; by default, tries `Rglpk`'s but falls back to `lpSolveAPI`'s.

### Details

`is.inCH()` was originally written for the "stepping" algorithm of Hummel et al (2012). See Krivitsky, Kuvelkar, and Hunter (2022) for detailed discussion of algorithms used in `is.inCH()` and `shrink_into_CH()`.

### Value

Logical, telling whether `p` is (or all rows of `p` are) in the closed convex hull of the points in `M`.

### Note

`is.inCH()` has been deprecated in favour of `shrink_into_CH()`, which returns the optimal step length instead of a yes-or-no test. In general, `shrink_into_CH(...)>=1` is equivalent to 'is.inCH(...).

### References

- https://www.cs.mcgill.ca/~fukuda/soft/polyfaq/node22.html

- Hummel, R. M., Hunter, D. R., and Handcock, M. S. (2012), Improving Simulation-Based Algorithms for Fitting ERGMs, Journal of Computational and Graphical Statistics, 21: 920-939.

- Krivitsky, P. N., Kuvelkar, A. R., and Hunter, D. R. (2022). Likelihood-based Inference for Exponential-Family Random Graph Models via Linear Programming. arXiv preprint arXiv:2202.03572. https://arxiv.org/abs/2202.03572

[Package ergm version 4.2.1 Index]