[R] truncated multivariate normal

Ben Bolker bolker at zoo.ufl.edu
Tue Sep 30 23:29:43 CEST 2003

  Do you mean you want to generate deviates from this distribution or that 
you want the density function (or distribution function)?

mvrnorm in package MASS (library(MASS)) will generate multivariate normal
deviates.  A brute-force approach would just keep picking values until you
get ones in the right quadrant, although with your example (large
variance, small mean) that would mean you would be wasting 3/4 of your 
values -- so there are probably more efficient approaches.  Depends how 
much time you want to spend programming, how many values you want to draw, 
and how fast your computer is ...


On Tue, 30 Sep 2003, Juliana Garcia Cespedes wrote:

> Please,    
> I would like to know how to generate a truncated multivariate normal
> distribution k - dimensional,    X ~ NT(mu, Sigma),  where the
> elements of X to be non-negative (except the first), and the first
> dimension is strictly larger than zero.    
> Example:  
> X ~ NT_2(mu, Sigma),   
> where mu=c(0.5, 0.5) and Sigma=c([120, 191], [191,154]), with X_1>0
> and X_2>=0  
> Could anybody help me?     
> Thanks in advanced.
> Juliana G. Cespedes
> Mestranda em Estatística e Experimentação Agronômica
> Departamento de Ciências Exatas - ESALQ/USP
> São Paulo - Brasil
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

620B Bartram Hall                            bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

More information about the R-help mailing list