[R] Question about KLdiv and large datasets

Peter Ehlers ehlers at ucalgary.ca
Mon Jul 19 06:40:19 CEST 2010


I just answered this but realize that I did so off-list.
So, for completeness, here's what I said:

I think I see the problem. From ?KLdiv, you're getting the
modeltools help page. What you need is the flexmix help
page for KLdiv. Just get to the flexmix index page
(you can do ?flexmix and then click on the 'Index' link at
the bottom). Then select KLdiv-method. Here you will find
the eps argument described. Its default value is eps=10^-4
and the description says:

eps     Probabilities below this threshold are replaced by this 
threshold for numerical stability.

It's this comment that makes me doubt the reliability for
very small eps values.

Cheers,
Peter


On 2010-07-18 20:50, Ralf B wrote:
> Is the 'eps' argument part of KLdiv (was not able to find that in the
> help pages) or part of a general environment (such as the graphics
> parameters 'par' ) ? I am asking so that I can read about it what it
> actually does to resolve the question you already raised about its
> reliability...
>
> Ralf
>
> On Fri, Jul 16, 2010 at 10:41 AM, Peter Ehlers<ehlers at ucalgary.ca>  wrote:
>> On 2010-07-16 7:56, Ralf B wrote:
>>>
>>> Hi all,
>>>
>>> when running KL on a small data set, everything is fine:
>>>
>>> require("flexmix")
>>> n<- 20
>>> a<- rnorm(n)
>>> b<- rnorm(n)
>>> mydata<- cbind(a,b)
>>> KLdiv(mydata)
>>>
>>> however, when this dataset increases
>>>
>>> require("flexmix")
>>> n<- 10000000
>>> a<- rnorm(n)
>>> b<- rnorm(n)
>>> mydata<- cbind(a,b)
>>> KLdiv(mydata)
>>>
>>>
>>> KL seems to be not defined. Can somebody explain what is going on?
>>>
>>> Thanks,
>>> Ralf
>>
>> Ralf,
>>
>> You can adjust the 'eps=' argument. But I don't know
>> what this will do to the reliability of the results.
>>
>> KLdiv(mydata, eps = 1e-7)
>>
>>   -Peter Ehlers
>>



More information about the R-help mailing list