[R] density estimate
Eik Vettorazzi
E.Vettorazzi at uke.uni-hamburg.de
Mon Sep 29 17:10:46 CEST 2008
The calculation of the Kullback Leibler measure depends on the scale of
your probability function. If it is discrete, the formula with "sum"
term applies. In the continuous case "sum" is replaced by "intgrate".
you may have a look at
http://finzi.psych.upenn.edu/R/library/flexmix/html/KLdiv.html which
covers both cases.
For continuous random variables you can typically get only probability
statements for intervals - by integrating the density function over the
range of the given interval. If your sample space is uncountable (say
for instance the set of all real numbers), then it can be shown that
every elementary event has to have a probability of zero.
hth.
Sumithran schrieb:
> Thank you.
>
> I need the probability, because I'm trying to get the Kullback Leibler measure between two densities. Is there any package which gives the probability function for continuous distributions?
>
>
> Thaks,
>
> Lavan
>
> --- On Mon, 9/29/08, Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de> wrote:
>
>
>> From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de>
>> Subject: Re: [R] density estimate
>> To: "Lavan" <rsumithran at yahoo.com>
>> Cc: r-help at r-project.org
>> Date: Monday, September 29, 2008, 7:39 AM
>> Hi Lavan,
>> a continuous density is not restricted to be within [0, 1].
>> Its only
>> bound to have an integral of 1.
>> For example
>> dnorm(0,sd=.1)
>> is a very common density and gives 3.989423. A density
>> function is not a
>> probability function!
>> If you think your data x is discrete than you can assign
>> the correct
>> probability mass for each data point by
>> prop.table(table(x))
>>
>> hth.
>>
>> Lavan schrieb:
>>
>>> Hi,
>>>
>>> I have a vector or random variables and I'm
>>>
>> estimating the density using
>>
>>> "bkde" function in the KernSmooth package.
>>>
>> The out put contains two vectors
>>
>>> (x and y), and the R documentation calls y as the
>>>
>> density estimates, but my
>>
>>> y-values are not exact density etstimates (since these
>>>
>> are numbers larger
>>
>>> than 1)! what is y here? Is it possible to get the
>>>
>> true estimated density at
>>
>>> each value of x?
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>> --
>> Eik Vettorazzi
>> Institut für Medizinische Biometrie und Epidemiologie
>> Universitätsklinikum Hamburg-Eppendorf
>>
>> Martinistr. 52
>> 20246 Hamburg
>>
>> T ++49/40/42803-8243
>> F ++49/40/42803-7790
>>
>
>
>
>
--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf
Martinistr. 52
20246 Hamburg
T ++49/40/42803-8243
F ++49/40/42803-7790
More information about the R-help
mailing list