简体   繁体   English

R mixdist package 中的泊松分布

[英]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.我认为我的数据可能由泊松分布的总和来描述,我发现了关于mixdist的 mixdist package。 I managed to fit gamma and lnorm distributions, but I can't figure out how to use Poisson.我设法拟合了 gamma 和 lnorm 分布,但我不知道如何使用 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但我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?如何获得 mixdist 和 Poisson 的工作示例?

Are you looking for this:您是否正在寻找这个:

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

Simply mix(poisdat, poispar, "pois") gives an Error:简单地mix(poisdat, poispar, "pois")给出一个错误:

Error in testconstr(mixdat, mixpar, dist, constr): Poisson needs consigma = POIS. testconstr 中的错误(mixdat、mixpar、dist、constr):泊松需要 consigma = POIS。

thas why this constr parameter.这就是为什么这个constr参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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