On 2/10/2008, at 4:43 AM, Sasha Pustota wrote:
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute Pr(X=x,Y=y) and Pr(X<x,Y<y) for a bivariate normal. Are there functions that would compute Pr(X<x,Y=y)?
Yes: foo <- function(x,y) { 0 }
I'm currently using "integrate" with dmvnorm but it is too slow.
Words fail me ..... see fortune("brain surgery"). I presume you really want Pr(X < x | Y = y) rather than the probability that X is less than x *and* Y equals y. To find this, see any decent textbook on multivariate statistics. (E.g. Morrison.) You can explicitly write down the distribution of X given that Y = y. If (X,Y) is bivariate Gaussian with mean mu and covariance matrix Sigma then *given that* Y = y, X has a Gaussian distribution with mean mu[1] + Sigma[1,2]*(y-mu[2])/Sigma[2,2] and variance equal to Sigma[1,1] - (Sigma[1,2]^2)/Sigma[2,2] Knowing that, you can use pnorm to calculate Pr(X<x | Y=y). cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}} ______________________________________________ R-help@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.