Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: std. bivariate nrm. dist.


From   Gary Longton <[email protected]>
To   [email protected]
Subject   Re: st: RE: std. bivariate nrm. dist.
Date   Wed, 08 Dec 2004 13:13:09 -0800

As an (hopefully easier) alternative, The BVN density formula Tom provides is also wrapped in the short program -bnormpdf- on SSC.

type -ssc describe bnormpdf-

- Gary

Steichen, Thomas J. wrote:


Fatma Bircan writes:

I want to calculte the standard bivariate normal distribution for the two variables with correlation. Say X and Y are my variables and rho is the correlation term. How do I calculate the standard bivariate normal distribution function for f(X, Y, rho) in Stata

This looks like you want the density function...

Given x and y are standardized variables x = (X-Xbar)/sd(X) and y = (Y-Ybar)/sd(Y) (where Xbar is the mean of X and sd(X) is the standard deviation of X, etc)
and p = rho

f(x,y,p) = (1 / (2*_pi*sqrt(1-p^2)) * exp( -1/(2*(1-p)) * (x^2 - 2*p*x*y + y^2) )


Given unstandardized variables X and Y

f(X,Y,p) = (1 / (2*_pi*sd(X)*sd(Y)*sqrt(1-p^2)) * exp( -1/(2*(1-p)) * ( ((X-Xbar)/sd(X))^2 - 2*p*(X-Xbar)/sd(X)*(Y-Ybar)/sd(Y) + ((Y-Ybar)/sd(Y))^2 ) )
Hope I got all those parentheses in there.

Tom
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index