[R] mixture normal distributions

From: <aleid2001_at_yahoo.com>
Date: Sat 11 Feb 2006 - 02:02:09 EST


Dear R helper,

I mange to transform uniform sequences to mixture normal distributions using the following cods:

> K<-50000
> prime<-c(29) , where 29 is prim number
> UN<-seq(1:K)%*%t(sqrt(prime))
> U1<-UN-as.integer(UN)
> e<-norMix(mu=c(-0.825,0.275), sig2 = c(0.773,0.773),
w = c(0.25,0.75), name = NULL, long.name = FALSE)
> U<-matrix(qnorMix(e,U1),K,1),

But somtimes if i use ,e.g, 23 or 11 instead of 29 it will give me the following error.

> K<-30000
> prime<-c(23)
> UN<-seq(1:K)%*%t(sqrt(prime))
> U1<-UN-as.integer(UN)
> e<-norMix(mu=c(-0.825,0.275), sig2 = c(0.773,0.773),
w = c(0.25,0.75), name = NULL, long.name = FALSE)
> U<-matrix(qnorMix(e,U1),K,1)

Error in uniroot(function(l) pnorMix(obj, l) - pp[i], interval = rq) :

        f() values at end points not of opposite sign

I am seeking help how to avoid this error.

Many thanks for your help in advance.

My E-mail is aleid2001@yahoo.com

Al-Eid

The university of Manchester.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 11 02:06:11 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:27 EST