Gaomeng
2012-May-24 08:49 UTC
[R] Mistake:number of cluster centres must lie between 1 and nrow(x)
Dear List: I write codes to get"Mean and standard deviations (Std.) for EM estimates—500 samples from the FM-ST model"(R package mixsmsn).It has a mistake:"number of cluster centres must lie between 1 and nrow(x) ". my codes below: mu1 <- c(2,2) Sigma1 <- matrix(c(1.5,0,0,1.5), 2,2) shape1 <-c(-5,10) nu1 <- 4 mu2 <- c(-2,-1) Sigma2 <- matrix(c(1.5,0,0,1.5), 2,2) shape2 <-c(-5,10) nu2 <- 4 pii<-c(0.6,0.4) arg1 = list(mu=mu1, Sigma=Sigma1, shape=shape1, nu=nu1) arg2 = list(mu=mu2, Sigma=Sigma2, shape=shape2, nu=nu2) y <- rmmix(n=500, p = pii, "Skew.t", list(arg1,arg2)) St.analysis <- smsn.mmix(y, nu=3, g=2, get.init = TRUE, criteria = TRUE, group = TRUE, family = "Skew.t",calc.im=TRUE) St.analysis ##skew t fit giving intial values for(i in 1:500){ mu1 <- c(0,0) Sigma1 <- matrix(c(1,0,0,1), 2,2) shape1 <-c(-1,5) nu1 <- 10 mu2 <- c(0,0) Sigma2 <- matrix(c(1,0,0,1), 2,2) shape2 <-c(-1,5) nu2 <- 10 pii<-c(0.5,0.5) mu<-list(mu1,mu2) #nu<-list(nu1,nu2) Sigma<-list(Sigma1,Sigma2) shape<-list(shape1,shape2) St.analysis[i] <- smsn.mix(y[i,],g=2,nu=10,mu=mu,shape=shape,pii pii,get.init = TRUE, criteria = TRUE,group = TRUE, family "Skew.t",calc.im=TRUE) print(St.analysis[i]) } -- View this message in context: http://r.789695.n4.nabble.com/Mistake-number-of-cluster-centres-must-lie-between-1-and-nrow-x-tp4631177.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]