[R] comparison of bivariate normal distributions

David Winsemius dwinsemius at comcast.net
Thu Apr 26 01:46:46 CEST 2012


If you read the Posting Guide, you will see that cross-posting is  
deprecated on r-help ...(although not explicitly so on StackOverflow.)


On Apr 25, 2012, at 4:43 PM, Fabian Roger wrote:

> sorry for cross-posting
>
> Dear all,
>
> I have tow (several) bivariate distributions with a known mean and  
> variance-covariance structure (hence a known density function) that  
> I would like to compare in order to get an intersect that tells me  
> something about "how different" these distributions are (as t- 
> statistics for univariate distributions).
>
> In order to visualize what I mean hear a little code example:
>
> ########################################
> library(mvtnorm)
>
> c<-data.frame(rnorm(1000,5,sd=1),rnorm(1000,6,sd=1))
> c2<-data.frame(rnorm(1000,10,sd=2),rnorm(1000,7,sd=1))
>
> xx=seq(0,20,0.1)
> yy=seq(0,20,0.1)
> xmult=cbind(rep(yy,201),rep(xx,each=201))
> dens=dmvnorm(xmult,mean(c),cov(c))
> dmat=matrix(dens,ncol=length(yy),nrow=length(xx),byrow=F)
>
> dens2=dmvnorm(xmult,mean(c2),cov(c2))
> dmat2=matrix(dens2,ncol=length(yy),nrow=length(xx),byrow=F)
> contour(xx,yy,dmat,lwd=2)
> contour(xx,yy,dmat2,lwd=2,add=T)
> ##############################################
>
> Is their an easy way to do this (maybe with dmvnorm()?) and could I  
> interpret the intersect ("shared volume") in the sense of a t- 
> statistic?
>
> Thanks a lot for your help!
>
> _____________________________________
> Fabian Roger, Ph.D. student
> Dept of Biological and Environmental Sciences
> University of Gothenburg
> Box 461
> SE-405 30 Göteborg
> Sweden
> Tel. +46 31 786 2933
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list