简体   繁体   中英

Poisson distribution in R mixdist package

I think my data might be described by a sum of Poisson distributions and I found out about mixdist package for R. I managed to fit gamma and lnorm distributions, but I can't figure out how to use Poisson. I tried with the example data first:

    library(mixdist) 
    data(poisdat)
    data(poispar)
    plot.mixdata(poisdat) #this works
    fitp<-mix(poisdat, coef(poispar), "pois") #this doesn't

but I get an error Error in if (usecondit & ncol(mixdat) - 2.= k) stop("Conditional data are not consistent with mixpar:") : argument is of length zero

How to get a working example of mixdist and Poisson?

Are you looking for this:

mix(poisdat, poispar, "pois", constr = mixconstr(consigma = "POIS"))

Simply mix(poisdat, poispar, "pois") gives an Error:

Error in testconstr(mixdat, mixpar, dist, constr): Poisson needs consigma = POIS.

thas why this constr parameter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM