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:> 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) > #################################### > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Dear Rui, Many thanks, it perfectly works. Yes it was because of non-integer in vector x. best, Le mercredi 29 mai 2019 ? 11:55:06 UTC+2, Rui Barradas <ruipbarradas at sapo.pt> a ?crit : 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:> 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)> #################################### > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.>