I am wishing to sample from a truncated multivariate normal distribution directly in Matlab.
I am aware I can simply use mvnrnd and check whether the returned value is within the domain of interest. However, this is a waste of resources when a large number of samples are needed.
Matlab has a built in function truncate reference that will truncate a given probability distribution object. Unfortunately, mvnpdf reference returns the value of the pdf at a given location, not the probability object see: pdf. Moreover, truncate only seems to support 1-dimensional problems.
Any ideas how to to sample directly from a truncated multivariate normal, aside from simply ignoring data outside the domain of interest? Or is this generally something I will have to live with?
Examples on the file exchange seem to implement some form of rejection sampling:
Truncated Multivariate Normal Generator
Another Truncated Normal Generator
Aucun commentaire:
Enregistrer un commentaire