search for: kldiv

Displaying 9 results from an estimated 9 matches for "kldiv".

2009 Sep 22
3
problem using KLdiv - flexmix
I am receiving the following error while executing KLdiv method: kl<-KLdiv(y) Error in function (classes, fdef, mtable) : unable to find an inherited method for function "KLdiv", for signature "data.frame" the code is as follows: require(flexmix) KLdiv(y) the object y (snippet, actual object contains 188 entries) is as follo...
2010 Aug 04
0
Kullback–Leibler divergence question (flexmix::KLdiv) Urgent!
Hi all, x <- cbind(rnorm(500),rnorm(500)) KLdiv(x, eps=1e-4) KLdiv(x, eps=1e-5) KLdiv(x, eps=1e-6) KLdiv(x, eps=1e-7) KLdiv(x, eps=1e-8) KLdiv(x, eps=1e-9) KLdiv(x, eps=1e-10) ... KLdiv(x, eps=1e-100) ... KLdiv(x, eps=1e-1000) When calling flexmix::KLdiv using the given code I get results with increasing value the smaller I pick the accuracy pa...
2010 Jul 15
1
KLdiv question (data.frame)
Hi all, I wonder why KLdiv does not work with data.frames: n <- 50 mydata <- data.frame( sequence=c(1:n), data1=c(rnorm(n)), data2=c(rnorm(n)) ) # does NOT work KLdiv(mydata) # works fine dataOnly <- cbind(mydata$data1, mydata$data2, mydata$group) KLdiv(dataOnly) Any ideas? Is there a better implementation tha...
2010 Jul 16
1
Question about KLdiv and large datasets
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
2010 Jul 09
1
KLdiv produces NA. Why?
I am trying to calculate a Kullback-Leibler divergence from two vectors with integers but get NA as a result when trying to calulate the measure. Why? x <- cbind(stuff$X, morestuff$X) x[1:5,] [,1] [,2] [1,] 293 938 [2,] 293 942 [3,] 297 949 [4,] 290 956 [5,] 294 959 KLdiv(x) [,1] [,2] [1,] 0 NA [2,] NA 0 Best, Ralf
2010 Jul 15
1
Repeated analysis over groups / Splitting by group variable
...quot;) # for Kullback-Leibler divergence n <- 23 groups <- c(1,2,3) mydata <- data.frame( sequence=c(1:n), data1=c(rnorm(n)), data2=c(rnorm(n)), group=rep(sample(groups, n, replace=TRUE)) ) # Part 1: full stats (works fine) dataOnly <- cbind(mydata$data1, mydata$data2, mydata$group) KLdiv(dataOnly) # # Part 2: again - but once for each group (error) # by(dataOnly, groups, KLdiv(dataOnly)) The error I am getting is: Error in tapply(1L:23L, list(INDICES = c(1, 2, 3)), function (x) : arguments must have same length Are there better ways than 'by' ? I would like to use dif...
2008 Oct 19
0
Kullback Leibler Divergence
Hi there, I'm trying to find the KL divergence measure between a prior and it's posterior distributions, and I'm using the KLdiv method in the flexmix package. plese see the example below: require(flexmix) x=seq(-4,4,length=100) d1=dnorm(x,0,1) d2=dunif(x,-3,3) y=cbind(d1,d2) kl=KLdiv(y) but let say, x1=seq(-5,5,length=100) d3=dunif(x1,-3,3) y1=cbind(d1,d3) kl1=KLdiv(y1) Notice that kl1 and kl are not the same. the docu...
2008 Sep 29
2
density estimate
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
2008 Oct 15
0
R-help Digest, Vol 67, Issue 31
...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 c...