cpgs: Complex Polytope Gibbs Sampling This function draw uniform...

Description Usage Arguments Value Details Examples

View source: R/RcppExports.R

Description

Complex Polytope Gibbs Sampling This function draw uniform samples in a convex polytope with inequality constraints

Usage

1
cpgs(N, A, b, x0, thin = 1L)

Arguments

N

the number of samples to generate

A

a matrix

b

a vector of length equals to nrow(A)

x0

a vector of length equals to nrcol(A) that should be in the polytope, for example returned by chebycenter

thin

thinning interval

Value

a matrix with one row per sample and one column per parameter

Details

This function is based on an initial matlab code developped called CPRND (https://ch.mathworks.com/matlabcentral/fileexchange/34208-uniform-distribution-over-a-convex-polytope) It generates samples within the complex polytope defined by A \cdot x ≤qslant b

Examples

1
2
3
4
5
6
7
8
9
n <- 20
A1 <- -diag(n)
b1 <- as.matrix(rep(0,n))
A2 <- diag(n)
b2 <- as.matrix(rep(1,n))
A <- rbind(A1,A2)
b <- rbind(b1,b2)
X0 <- chebycenter(A,b)
x <- cpgs(1000,A,b,X0)

Irstea/cpgsR documentation built on Jan. 25, 2020, 5:36 p.m.