Displaying 20 results from an estimated 10000 matches similar to: "R code for normal mixture EM algorithm"
2010 Mar 20
2
EM algorithm in R
Please help me in writing the R code for this problem. I've been solving this
for 4 days. It was hard for me to solve it. It's a simulation problem in R.
The problem is
My true model is a normal mixture which is given as
0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components.
I will get a random sample of size 100 from this model. I will do this 300
times.
That means, I will have
2009 May 21
1
em algorithm mixture of multivariate normals
Hi,
I would like to know if it is possible to have a "R code" to estimate the
parameters of a mixture of bivariate (or multivariate) normals via EM
Algorithm. I tried to write it, but in the estimation of the matrix of
variance and covariance, i have some problems. I generate two bidimensional
vectors both from different distribution with their own vector means and
variance and
2006 Nov 27
0
EM algorithm for truncated multivariate mixture of normals
I couldn't find a direct answer in CRAN to this question, so I'm asking
with some trepidation. I have a multivariate dataset (data.frame) with
columns that can be expressed as a set of mixed normals (at least I think)
and need to impute values that have constraints (truncated mixture of
normals where the values cannot be below zero). If there isn't a package
that can do this, is there
2004 Nov 16
2
help on EM Algorithm for bivariate normal
Hi,
I woul like to know if it is possible to have a "R code" to generate EM
Algorithm for a normal bivariate mixture.
Best regard,
S.F.
2013 Mar 30
1
normal mixture EM not working?
Hi,
I am currently working on fitting a mixture density to financial data.
I have the following data:
http://s000.tinyupload.com/?file_id=00083355432555420222
I want to fit a mixture density of two normal distributions.
I have the formula:
f(l)=πϕ(l;μ1,σ21)+(1−π)ϕ(l;μ2,σ22)
my R code is:
normalmix<-normalmixEM(dat,k=2,fast=TRUE)
pi<-normalmix$lambda[1]
mu1<-normalmix$mu[1]
2009 May 22
0
EM algorithm mixture of multivariate
Hi, i would to know, if someone have ever write the code to estimate the
parameter (mixing proportion, mean, a var/cov matrix) of a mixture of two
multivariate normal distribution. I wrote it and it works (it could find
mean and mixing proportion, if I fix the var/cov matrix), while if I fix
anything, it doesn't work. My suspect is that when the algorithm iterates
the var/cov matrix, something
2009 May 22
0
EM algorithm mixture of multivariate gaussian
Hi, i would to know, if someone have ever write the code to estimate the
parameter (mixing proportion, mean, a var/cov matrix) of a mixture of two
multivariate normal distribution. I wrote it and it works (it could find
mean and mixing proportion, if I fix the var/cov matrix), while if I fix
anything, it doesn't work. My suspect is that when the algorithm iterates
the var/cov matrix, something
2011 Feb 28
1
mixture models/latent class regression comparison
Dear list,
I have been comparing the outputs of two packages for latent class
regression, namely 'flexmix', and 'mmlcr'. What I have noticed is that
the flexmix package appears to come up with a much better fit than the
mmlcr package (based on logLik, AIC, BIC, and visual inspection). Has
anyone else observed such behaviour? Has anyone else been successful
in using the mmlcr
2009 Jul 26
1
normal mixture model
Hi, All,
I want to fit a normal mixture model. Which package in R is best for this? I
was using the package 'mixdist', but I need to group the data into groups
before fitting model, and different groupings seem to lead to different
results. What other package can I use which is stable? And are there
packages that can automatically determine the number of components?
Thank you,
Cindy
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
2009 Nov 09
1
model based clustering with flexmix
Hello all,
I am trying to fit a truncated mixture model and I wrote a driver for
flexmix following the example in the vignette, but it doesn't work for
me: it assigns all data points to one component only, e.g.:
> > source('bugged.R')
>
> Call:
> flexmix(formula = x ~ 1, k = 2, model = truncatedmodel(lower = -4,
> upper = 4))
>
> prior size
2008 May 23
0
Est. Component Size with AIC/BIC under Gamma Distribution
Dear all,
I am trying to model number of samples from
a given series. The series are modelled according
Gamma function.
In order to estimate the # samples, I use BIC/AIC
with MLE (computed from dgamma function).
Here is the code I have.
__BEGIN__
mlogl <- function( x_func, theta_func, samp) {
# computing log_likelihood
return( - sum(dgamma(samp, shape = x_func, scale=theta_func, log
2011 Apr 22
1
How to generate normal mixture random variables with given covariance function
Dear All,
Suppose Z_i, i=1,...,m are marginally identically distributed as a two normal mixture p0*N(0,1) + (1-p0) *N( miu_i, 1) where miu_i are identically distributed according to a mixture and I have generated Z_i one by one .
Now suppose these m random variables are jointly m-dimensional normal with correlation matrix M= (m_ij).
How to proceed next or how to start correctly ?
Question:
2010 May 18
1
BIC() in "stats" {was [R-sig-ME] how to extract the BIC value}
>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Tue, 18 May 2010 12:37:21 +0200 writes:
>>>>> "GaGr" == Gabor Grothendieck <ggrothendieck at gmail.com>
>>>>> on Mon, 17 May 2010 09:45:00 -0400 writes:
GaGr> BIC seems like something that would logically go into stats
2005 Apr 18
2
Why no BIC.default function?
I'm using R 2.0.1.
I looked in the email archives but didn't see anything on this topic.
I've noticed a surprising (to me) difference between AIC and BIC:
> methods("AIC")
[1] AIC.default* AIC.logLik*
> methods("BIC")
[1] BIC.gls* BIC.lm* BIC.lme* BIC.lmList* BIC.logLik* BIC.nls*
The BIC.gls BIC.lm BIC.lme BIC.lmList and BIC.nls functions appear
2008 May 13
1
R help: problems with step function
Dear List Members,
I have encountered two problems when using the step function to
select models. To better illustrate the problems, attached is an
R image which includes the objects needed to run the code attached.
lm.data.frame have factor variables with 3 levels.
The following run shows the first problem. AICs (* and **) are different.
I noticed that the Df for rs13482096:rs13483699 is 4,
2013 Mar 18
2
Fit a mixture of lognormal and normal distributions
Hello
I am trying to find an automated way of fitting a mixture of normal and log-normal distributions to data which is clearly bimodal.
Here's a simulated example:
x.1<-rnorm(6000, 2.4, 0.6)x.2<-rlnorm(10000, 1.3,0.1)X<-c(x.1, x.2)
hist(X,100,freq=FALSE, ylim=c(0,1.5))lines(density(x.1), lty=2, lwd=2)lines(density(x.2), lty=2, lwd=2)lines(density(X), lty=4)
Currently i am using
2008 May 14
0
Problems with step function
Dear List Members,
I have encountered two problems when using the step function to
select models. To better illustrate the problems, an R image
(step.add1.test.RData)
which includes the objects needed to run the code (step.add1.test.R) can be
found at
www.biostat.wisc.edu/~pwang/r-help/<http://www.biostat.wisc.edu/%7Epwang/r-help/>
lm.data.frame have factor variables with 3 levels.
The
2009 Jun 09
0
quantile of a mixture of bivriate normal distributions
Hi,
Does anyone know how to compute the quantile of a mixture of four
bivariate normal distriutions?
Many thanks!
Hannah
[[alternative HTML version deleted]]
2006 Feb 08
1
Mixture normal distribution
Dear R helper,
I hope that u can help me to sort out my problem
because I sent an E-mail last night to R-list but I
have not receive any help and at the same time I think
this problem is not so hard.
I have used the following functions before
> K<-10
> prime<-c(2,3,5,7,11,13,17)
> UN<-seq(1:K)%*%t(sqrt(prime))
> U1<-UN-as.integer(UN)
> U<-matrix(qnorm(U1),K,7)