powered by
Sample Gaussian distribution with linear constraints Taking truncated sample of Gaussian distribution over a linear constraint domain.
linconGauss( n, A, b, Sigma, mu, x_init = NULL, intersection = TRUE, n_retry_init = 1000, nskp = 5 )
number of samples to take
a matrix with M by D dimensions, the linear constraints, such that Ax+b>=0
the offset of the linear constraints with dimension M such that Ax+b>=0
covariance matrix of the Gaussian
mean vector of the Gaussian
the sample to start with, if NULL, a sample will be drawn using rejection method
bool whether sample from the intersection or the union of the linear constraints, default true, sample from the intersection
how many times to try finding a initial value
how many sample to skip during the sampling routine
a matrix with truncated sample, row as samples
# NOT RUN { my_sample <- linconGauss(100, diag(2),c(0,0),diag(2),c(0,0)) MASS_sample <- MASS::mvrnorm(1000,c(0,0),diag(2)) plot(MASS_sample) points(my_sample,col = "red") abline(h=0) abline(v=0) # }
Run the code above in your browser using DataLab