Statalist


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

Re: st: evaluating probabilities using kdensity


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: evaluating probabilities using kdensity
Date   Mon, 3 Mar 2008 13:56:08 +0000 (GMT)

*---------- begin example -------------
sysuse auto, clear
kdensity mpg, gen(x d) n(100)
integ d x if x < 20
*------------- end example ------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

--- Conner Mullally <[email protected]> wrote:

> Thanks for the help. I think I could have been more specific
> about exactly what I am trying to do.  
> I have 20 years of time series, which I have detrended. 
> What I want to do is to:
> a) Take the detrended time series and estimate a kernel
> density
> b) Use the estimated kernel density to estimate the expected
> value of shortfalls from the mean of the distribution.  That
> is, I want to calculate the integral of:
> (Mu-Yt)dF(Yt)dYt, for all Yt<Mu
> Where Mu is the mean, Yt is the random variable, and F(Yt)
> is the cumulative density function of Yt.
> The command kdensity returns the estimated density at
> whatever points were used to estimate the density, and I can
> add more points using the at() option.  But these will leave
> gaps at the omitted points in the support of the estimated
> distribution when I sum up the densities.  What I'm
> wondering is if there is a way to integrate under the curve
> of the estimated kernel density. Perhaps some stata
> programming is in my future, but if there is way to do this
> while using kdensity or something similar, I would love to
> know.  Thanks in advance.
> *
> *   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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Rise to the challenge for Sport Relief with Yahoo! For Good  

http://uk.promotions.yahoo.com/forgood/
*
*   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