[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"FEIVESON, ALAN H. (AL) (JSC-SD) (NASA)" <[email protected]> |

To |
"'[email protected]'" <[email protected]> |

Subject |
st: RE: integrals - 2nd correction! |

Date |
Fri, 22 Nov 2002 14:54:12 -0600 |

```
Dear Statalist and Clara - I must apologize again - I was in too much of a
hurry. I'll try this again. The bottom line is that I believe you can
evaluate this integral in terms of the 1-dimensional cumulative normal PHI
(-norm( ) - in Stata) and the 1-dimensional normal density fhi (-normd- in
Stata). It's messy , though. Here's an outline of how to proceed.
1. Suppose X and Y are random variables whose joint density is f(x,y)
(bivariate normal). Let E(X)=Ux, E(Y)=Uy , Var(X)=Sxx, Cov(X, Y)=Sxy and
V(Y)=Syy.
2. The joint density can be factored : f(x,y) = g(y|x)*h(x) where g(y|x), as
a function of y for fixed x, is the density of the conditional distribution
of Y given X=x, and h(x) is the marginal density of X.
3. Let I(t1,t2)F(t)dt denote the integral of a function F(t) with respect to
t, from t1 to t2. Let a = 0.56.
Then I(-oo, a)f(x,y)dy =h(x)I(-oo,a)g(y|x) = h(x)*P(Y<a|X=x).
But it is known (see Anderson, for example) that the distribution of Y given
X=x, is normal with mean Uy+B*(x-Ux) and variance Syy-B*B/Sxx, where B =
Sxy/Sxx.
Thus P(Y<a|X=x) = PHI[ (a - Uy-B*(x-Ux) ) / sqrt(Syy-B*B/Sxx) ] =
PHI(c*x + d), for known constants c and d.
Thus I(-oo, a)f(x,y)dy =h(x)*PHI(c*x + d), where h(x) = (1/sqrt(Sxx)*fhi(
(x-Ux)/sqrt(Sxx)).
4. Then your desired integral is the integral of x*h(x)*PHI(c*x + d) with
respect to x. Recall h(x) is the marginal density of X, so h(x) =
(1/sigx)*fhi( (x-Ux)/sigx ) , where fhi(z)=(1/sqrt(2*_pi) )*exp(-z*z/2) and
sigx=sqrt(Sxx).
5. Therefore, your desired integral is of the form
I = I(-oo, x) x*fhi(k*x + h)*PHI(c*x + d), where k, h, c and d are known
functions of the means and variances/covariances.
6. Now this integral can be obtained using integration by parts.
Differentiate PHI(c*x + d ) and integrate x*fhi(k*x + h ). The latter can
be obtained using the fact that d/dz fhi(z) = -z*fhi(z). (Messy details left
to the user!)
7. If you don't feel like doing Step 6 in closed form, you can always
evaluate it with a 1-dimensional numerical integration.
8. Good luck!
Al Feiveson
-----Original Message-----
From: Clara [mailto:[email protected]]
Sent: Friday, November 22, 2002 10:26 AM
To: [email protected]
Subject: st: integrals
hi, I need to solve a double integral. This integral does not have an
analytic solution, then i need to do this numerically. There are someone
that know how can i do this in stata??
I need to integral:
x*f(x,y)dxdy
where f(x,y) is a bivariate normal density function.
the integration intervals are: [-infinity, 0.56]
thanks, clara
*
* 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/
*
* 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/
```

- Prev by Date:
**Re: st: RE: generating age variable** - Next by Date:
**st: Typo in integral discussion** - Previous by thread:
**st: Asking Stata questions on Statalist** - Next by thread:
**st: Typo in integral discussion** - Index(es):

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