У меня 755 строк данных и ~ 87% нулей. Мне сложно сопоставить эти данные с нулевым раздутым Пуассоном или отрицательной биномиальной (или любой другой) регрессией. Я пробовал 4 разных способа и не могу заставить его работать. Я даже не совсем уверен, следует ли мне использовать именно эти регрессии. Любая помощь приветствуется. Я также не очень хорошо умею кодировать, что, я уверен, будет очевидно.
Я знаю, что это долго, но это мои фактические данные ...
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0.134916351861846,
0, 0.149907057624273, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691,
0.134916351861846, 0.134916351861846, 0, 0, 0.269832703723691,
0, 0.269832703723691, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.112430293218205, 0, 0, 0,
0, 0, 0, 0.367953686895943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.122651228965314, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.337290879654614,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.578212936550767, 0, 0, 0.404749055585537, 0, 0, 0, 0.269832703723691,
0.269832703723691, 0, 0, 0.299814115248546, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.192737645516922,
0.192737645516922, 0, 0, 0, 0.134916351861846, 0, 0.134916351861846,
0, 0, 0, 0, 0, 0.404749055585537, 0.134916351861846, 0.134916351861846,
0.337290879654614, 0, 0, 0, 0, 0.674581759309228, 0, 0.134916351861846,
0, 0.299814115248546, 0.168645439827307, 0.449721172872819, 0,
0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0.134916351861846,
0, 0, 0, 0.122651228965314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0.134916351861846, 0, 0.134916351861846, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0.122651228965314, 0, 0, 0.134916351861846,
0, 0, 0.149907057624273, 0, 0, 0, 0, 0.269832703723691, 0, 0,
0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.449721172872819, 0, 0, 0, 0, 0, 0, 0, 0.112430293218205,
0, 0, 0.134916351861846, 0.539665407447383, 0.134916351861846,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0.134916351861846,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.134916351861846, 0.134916351861846, 0, 0, 0, 0, 0, 0.134916351861846,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846,
0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0.404749055585537,
0, 0, 0.674581759309228, 0.269832703723691, 0, 0, 0, 0, 0, 0,
0.134916351861846, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0.269832703723691,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537,
0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0.269832703723691,
0.269832703723691, 0.134916351861846, 0, 0.404749055585537, 0.809498111171074,
0, 0.134916351861846, 0.134916351861846, 1.07933081489477, 0.134916351861846,
0, 0.269832703723691, 0, 0.94441446303292, 0.245302457930628,
0, 0, 0, 0, 0, 0.245302457930628, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Это 4 метода, которые я попробовал сегодня.
> hog.cpue <- hogA$hog.cpue
> fitg <- fitdist(hog.cpue, "ZIP")
Error in computing default starting values.
Error in manageparam(start.arg = start, fix.arg = fix.arg, obs = data, :
Error in start.arg.default(obs, distname) :
Unknown starting values for distribution ZIP.
> fit_zip2 <- fitdist(hogA$hog.cpue, 'nbinom', start = list(mu = 0.293, size = 0.1))
<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data, gr = gradient, ddistnam = ddistname, hessian = TRUE, method = meth, lower = lower, upper = upper, ...): function cannot be evaluated at initial parameters>
Error in fitdist(hogA$hog.cpue, "nbinom", start = list(mu = 0.293, size = 0.1)) :
the function mle failed to estimate the parameters,
with the error code 100
> fitzip <- fitdist(hogA$hog.cpue, "ZIP", start = list(mu = 0.293, sigma = 0.1), discrete = TRUE,
+ optim.method = "L-BFGS-B", lower = c(0, 0), upper = c(Inf, 1))
<simpleError in dZIP(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0.134916351861846, 0, 0.149907057624273, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0.134916351861846, 0.134916351861846, 0, 0, 0.269832703723691, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.112430293218205, 0, 0, 0, 0, 0, 0, 0.367953686895943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.122651228965314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.337290879654614, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.578212936550767, 0, 0, 0.404749055585537, 0, 0, 0, 0.269832703723691, 0.269832703723691, 0, 0, 0.299814115248546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.192737645516922, 0.192737645516922, 0, 0, 0, 0.134916351861846, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0.404749055585537, 0.134916351861846, 0.134916351861846, 0.337290879654614, 0, 0, 0, 0, 0.674581759309228, 0, 0.134916351861846, 0, 0.299814115248546, 0.168645439827307, 0.449721172872819, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0.122651228965314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.122651228965314, 0, 0, 0.134916351861846, 0, 0, 0.149907057624273, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.449721172872819, 0, 0, 0, 0, 0, 0, 0, 0.112430293218205, 0, 0, 0.134916351861846, 0.539665407447383, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0.134916351861846, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0.404749055585537, 0, 0, 0.674581759309228, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0.269832703723691, 0.269832703723691, 0.134916351861846, 0, 0.404749055585537, 0.809498111171074, 0, 0.134916351861846, 0.134916351861846, 1.07933081489477, 0.134916351861846, 0, 0.269832703723691, 0, 0.94441446303292, 0.245302457930628, 0, 0, 0, 0, 0, 0.245302457930628, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), mu = 0, sigma = 1, log = TRUE): mu must be greater than 0
>
Error in fitdist(hogA$hog.cpue, "ZIP", start = list(mu = 0.293, sigma = 0.1), :
the function mle failed to estimate the parameters,
with the error code 100
In addition: Warning messages:
1: In fitdist(hogA$hog.cpue, "ZIP", start = list(mu = 0.293, sigma = 0.1), :
The dZIP function should return a zero-length vector when input has length zero
2: In fitdist(hogA$hog.cpue, "ZIP", start = list(mu = 0.293, sigma = 0.1), :
The pZIP function should return a zero-length vector when input has length zero
> fpoisZI <- fitdist(hogA$hog.cpue, "ZIP", start=list(sigma=sum(hogA$hog.cpue == 0)/length(hogA$hog.cpue), mu=mean(hogA$hog.cpue)))
<simpleError in dZIP(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0.134916351861846, 0, 0.149907057624273, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0.134916351861846, 0.134916351861846, 0, 0, 0.269832703723691, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.112430293218205, 0, 0, 0, 0, 0, 0, 0.367953686895943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.122651228965314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.337290879654614, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.578212936550767, 0, 0, 0.404749055585537, 0, 0, 0, 0.269832703723691, 0.269832703723691, 0, 0, 0.299814115248546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.192737645516922, 0.192737645516922, 0, 0, 0, 0.134916351861846, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0.404749055585537, 0.134916351861846, 0.134916351861846, 0.337290879654614, 0, 0, 0, 0, 0.674581759309228, 0, 0.134916351861846, 0, 0.299814115248546, 0.168645439827307, 0.449721172872819, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0.122651228965314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.122651228965314, 0, 0, 0.134916351861846, 0, 0, 0.149907057624273, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.449721172872819, 0, 0, 0, 0, 0, 0, 0, 0.112430293218205, 0, 0, 0.134916351861846, 0.539665407447383, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0.134916351861846, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0.404749055585537, 0, 0, 0.674581759309228, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0.269832703723691, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.404749055585537, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0.269832703723691, 0.269832703723691, 0.134916351861846, 0, 0.404749055585537, 0.809498111171074, 0, 0.134916351861846, 0.134916351861846, 1.07933081489477, 0.134916351861846, 0, 0.269832703723691, 0, 0.94441446303292, 0.245302457930628, 0, 0, 0, 0, 0, 0.245302457930628, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.134916351861846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), sigma = 0.426547699594046, mu = -0.020557328452897, log = TRUE): mu must be greater than 0
>
Error in fitdist(hogA$hog.cpue, "ZIP", start = list(sigma = sum(hogA$hog.cpue == :
the function mle failed to estimate the parameters,
with the error code 100
In addition: Warning messages:
1: In fitdist(hogA$hog.cpue, "ZIP", start = list(sigma = sum(hogA$hog.cpue == :
The dZIP function should return a zero-length vector when input has length zero
2: In fitdist(hogA$hog.cpue, "ZIP", start = list(sigma = sum(hogA$hog.cpue == :
The pZIP function should return a zero-length vector when input has length zero