Displaying 20 results from an estimated 10000 matches similar to: "Kullback–Leibler divergence question (flexmix::KLdiv) Urgent!"
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
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
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 follows:
s1p5 s2p5
1 0.6 0.8
2 0.8
2010 Jul 15
1
Repeated analysis over groups / Splitting by group variable
I am performing some analysis over a large data frame and would like
to conduct repeated analysis over grouped-up subsets. How can I do
that?
Here some example code for clarification:
require("flexmix") # 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,
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
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 that can deal with
data.frame or is there a simpler way of converting?
Ralf
2004 Oct 19
0
flexmix version 1.0-0 released
Dear useRs,
FlexMix version 1.0-0 has been released on CRAN. FlexMix implements a
general framework for finite mixtures of regression models using the
EM algorithm. FlexMix provides the E-step and all data handling,
while the M-step can be supplied by the user to easily define new
models. Existing drivers implement mixtures of standard linear models,
generalized linear models and model-based
2004 Oct 19
0
flexmix version 1.0-0 released
Dear useRs,
FlexMix version 1.0-0 has been released on CRAN. FlexMix implements a
general framework for finite mixtures of regression models using the
EM algorithm. FlexMix provides the E-step and all data handling,
while the M-step can be supplied by the user to easily define new
models. Existing drivers implement mixtures of standard linear models,
generalized linear models and model-based
2009 Dec 04
0
flexmix and mclust help
Hello,
I'm trying out flexmix and mclust for the first time on some univariate data
which is typically best described as lognormal, but can sometimes be gamma
distributed as well. I first tried using EM on mclust assuming the data was
lognormally distributed and could only get it to work in "E" mode, i.e. the
equal variance mode. I could never get it to work on "V" mode [
2011 Feb 23
0
negative binomial latent class regression in package flexmix
Hello list,
Has anyone had any luck creating an M-step driver for negative
binomial regression for use with package flexmix? I've had a look
here: http://cran.r-project.org/web/packages/flexmix/vignettes/flexmix-intro.pdf
as well as poking around in the flexmix source, but I haven't had much
luck getting anything to work. I can't figure out how to a) come up
with an initial estimate
2012 Jun 15
0
Flexmix package
Hi,
I am using the package "flexmix" and would like get some assistance.
I am trying to run two equations jointly
Y1=X1B+E1
Y2=X2G+E2
So that I have X and Y in a matrix format and would like to run the latent
class model using flexmix.
Though, my problem here is that Flexmix automatically generates intercepts.
I have intercept for both of the equations that my X matrix looks like
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
2011 Jan 12
0
flexmix: predictions on new data from flexmix object
Dear R Users, R Core Team,
I currently wonder how to predict the probability of an event with new data resulting from a finite mixture.
I read the documentation of the flexmix package and the examples of applications provided on CRAN but I could not find how to predict (except "manually" but I am looking for a simpler solution) the final probability of the mixture (for each individual)
2011 Dec 21
0
Estimating a latent class multinomial logit regression with flexmix
I am trying to estimate a latent class multinomial logit regression with
flexmix.
I am not sure if I should do it as follows:
m4<-flexmix(cbind(y,1-y)~x1+x2|id,model=FLXMRglm(family="binomial"),data=NPreg,k=2)
,
where id links each row with the corresponding respondent.
Each respondent has 4 alternatives to chose from.
y takes the value 1 only for the alternative chosen;
x1 and
2007 Nov 20
0
try FlexMix RE: mulitmodal distributions
Hi, Marion,
I believe the package FlexMix provides a more generalized version of
finite mixture modeling than is found in mclust/mclust02.
Please see:
http://cran.r-project.org/doc/vignettes/flexmix/flexmix-intro.pdf
Karen
---
Karen M. Green, Ph.D.
Karen.Green@sanofi-aventis.com
Research Investigator
Drug Design Group
Sanofi Aventis Pharmaceuticals
-----Original Message-----
2006 Mar 21
0
finite mixture model, using flexmix
Dear R-users,
I would like to use the package flexmix to fit latent classes to a
regression model. My data are repeated measurements of bernouilli
variables so I can use the binomial family link to the glm function. The
design is not balanced, meaning that for some individuals in my data set
I have 10 measurements or more, for others I only have 5 or even less.
My question is the following. Can
2005 Apr 12
1
R Package: mmlcr and/or flexmix
Greetings
I'm a relatively new R user and I'm trying to build a latent class model.
I've used the 'R Site Search' and it appears there's not much dialogue on
these packages
On mmlcr, I've gotten it working, but not sure if I'm using it correctly.
On flexmix, I can only seem to get results for one class.
I'm attaching my code below - if anyone
2011 Feb 28
0
Gamma mixture models with flexmix
I've been trying with no success to model mixtures of Gamma distributions using
the package flexmix (see examples below). Can anyone help me get it to model
better? Thanks very much.
-Ben
##
## Please help me get flexmix to correctly model mixtures of
## Gamma distributions. See examples below.
##
library('flexmix')
##
## Plot a histogram of dat and the Gamma mixture model given
2011 Mar 01
1
Problem on flexmix when trying to apply signature developed in one model to a new sample
Problem on flexmix when trying to apply signature developed in one model to a new sample.
Dear
R Users, R Core Team,
I have a problem when trying to know the
classification of the tested cases using two variables with the function of flexmix:
After importing the database and creating
a matrix:
BM<-cbind(Data$var1,Data$var2)
I see that the best model has 2 groups and
use:
ex2
2012 Oct 30
1
Data set BregFix in package flexmix
Dear list:
I would like to recreate how the artificial data set BregFix was generated
in package flexmix (thanks Bettina and Friedrich). The data set is
thoroughly described in Grun and Leisch's Computational Statistics & Data
Analysis 51(11) :5247-5252 but references to the appropriate seed number(s)
are missing (providing these details was certainly beyond the scope of the
authors'