R 混合体产生太长的尾巴

R 混合体产生太长的尾巴,r,ggplot2,statistics,normal-distribution,R,Ggplot2,Statistics,Normal Distribution,我已经运行了我在这篇文章中找到的以下代码 wait2 wait2 <- normalmixEM(df$minutes,k=11,ECM=TRUE,maxit=10000) gg.mixEM <- function(EM) { require(ggplot2) x <- with(EM,seq(min(x),max(x),len=1000)) pars <- with(EM,data.frame(com

我已经运行了我在这篇文章中找到的以下代码

wait2
    wait2 <- normalmixEM(df$minutes,k=11,ECM=TRUE,maxit=10000)
    gg.mixEM <- function(EM) {
      require(ggplot2)
      x       <- with(EM,seq(min(x),max(x),len=1000))
      pars    <- with(EM,data.frame(comp=colnames(posterior), mu, sigma,lambda))
      em.df   <- data.frame(x=rep(x,each=nrow(pars)),pars)
      em.df$y <- with(em.df,lambda*dnorm(x,mean=mu,sd=sigma))
      ggplot(data.frame(x=EM$x),aes(x,y=..density..)) + 
      geom_histogram(fill=NA,color="black")+
      geom_polygon(data=em.df,aes(x,y,fill=comp),color="grey50", alpha=0.5)+
      scale_fill_discrete("Component\nMeans",labels=format(em.df$mu,digits=3))+
      theme_bw()
    }

gg.mixEM(wait2)