As rtmvnorm only allows one mean vector of one multivariate normal distribution,
but we need different mean vectors for different multivariate normal distributions,
we implement this function. This function in combination with apply
,
allows us to sample from a truncated multivariate normal distribution
with different mean vectors.
sampler(elements, Sigma)
Originally a matrix, but when passed to samp, it is a vector. The first length_mean elements are the mean vector of g and y, the next two elements are the lower bounds for g and y, the last two elements are the upper bounds for g and y.
The covariance matrix of the multivariate normal distribution to sample from.
A length_mean x 1 matrix with the samples for g and y.