Skip to content

Fitdistrplus package : Error messages

2 messages · varin sacha, Rui Barradas

#
Dear R-Experts,

Here is a toy example, reproducible example, I get error messages. I have tried to fix it by myself using "google is my friend", but I did not get it. If somebody can help me to fix these errors, would be highly appreciated.

##########################
install.packages("fitdistrplus")
library(fitdistrplus)

x=c(3,3.5,4.5,5,5.5,5.5,4.5,3.5,5,6,3,4,5,4.5,4,5.5,3.5,3,3)? 

##Poisson distribution
f2p=fitdist(x, "pois")
plot(f2p)
summary(f2p)

##negative binomial distribution
f2n=fitdist(x,"nbinom")
plot(f2n)
summary(f2n)
####################################
#
Hello,

This is because you have non-integer values in vector x?


This one works.

##Poisson distribution
f2p <- fitdist(floor(x), "pois")
plot(f2p)
summary(f2p)


Not so well

##negative binomial distribution
f2n <- fitdist(floor(x), "nbinom")
f2n <- fitdist(ceiling(x), "nbinom")
f2n <- fitdist(round(x), "nbinom")

plot(f2n)
summary(f2n)


Hope this helps,

Rui Barradas

?s 09:46 de 29/05/19, varin sacha via R-help escreveu: