I just tested and used this package. I noticed that the Gibbs sampler does not necessarily start in a feasible point (within the polygon). For large-dimensional problems, this can make the chance of arriving in the feasible space by random sampling extremely low.
I made a small modification to the code by using the constrained maximum likelihood solution as the first sample. This helps to avoid this situation.
Otherwise, I think this is a great piece of code. Thanks for sharing.
yes, thank you for your reply. However, in your GIBBS sampling, it appears that the number of iterations only depends on the sample size N. Let's say the user wants to generate 100 sample from multivariate truncated normal. Then the number of iterations based on your code for Gibbs sampling is always going to be 100.
Also, I read the paper you reference in your code. However, I am not sure that accept-rejection method is from that paper. Perhaps, you could add another reference? Also, could you please add more comments to that part of the code? Thanks!