cpgsEquality: 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 both equality and inequality constraints

Usage

1
cpgsEquality(N, A, b, C, v, x0, thin = 1L)

Arguments

N

the number of samples to generate

A

a matrix of coefficients of inequality constants A.x<=b

b

a vector of length equals to nrow(A)

C

a matrix of coefficients of inequality constants C.x=v

v

a vector of length equals to nrow(C)

x0

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

thin

the 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
10
11
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)
C <- rbind(c(1,1,rep(0,n-2)),c(0,0,1,1,rep(0,n-4)))
v <- matrix(rep(0.2,2),2)
X0 <- rep(0.1,n)
x <- cpgsEquality(1000,A,b,C,v,X0)

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