# Problem with Poisson distribution fitting of an array of floats (suffstats is not implemented for (Poisson, Array{Float64,1}))

**URL:** <https://discourse.julialang.org/t/problem-with-poisson-distribution-fitting-of-an-array-of-floats-suffstats-is-not-implemented-for-poisson-array-float64-1/62898>\
**Category:** General Usage\
**Tags:** question, statistics, distributions\
**Created:** [June 14, 2021, 4:51pm UTC](https://discourse.julialang.org/t/problem-with-poisson-distribution-fitting-of-an-array-of-floats-suffstats-is-not-implemented-for-poisson-array-float64-1/62898 "2021-06-14T16:51:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndresCasillas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrescasillas/32/27133_2.png) [@AndresCasillas](https://discourse.julialang.org/u/AndresCasillas)\
**Post date:** [June 14, 2021, 4:51pm UTC](https://discourse.julialang.org/t/problem-with-poisson-distribution-fitting-of-an-array-of-floats-suffstats-is-not-implemented-for-poisson-array-float64-1/62898/1 "2021-06-14T16:51:43Z")

</div>

Hi, I’m currently working in Windows 10 with Julia 1.5.3 in a Jupyter notebook, using Distributions.

I have an array of type Array{Float64,1} called “derivadas\_reales\_desplazado”. I want to fit a Poisson distribution to this array of data, but when I type:

fit\_mle(Poisson, derivadas\_reales\_desplazado)  
or  
Distributions.fit\_mle(Distributions.Poisson, derivadas\_reales\_desplazado)

it outputs the following issue:

suffstats is not implemented for (Poisson, Array{Float64,1}).

The values of “derivadas\_reales\_desplazado” are in the (0,1) interval, so there should be no problem fitting a Poisson distribution to it.  
I also find this curious since fit\_mle(Normal, derivadas\_reales\_desplazado) works fine.  
Andy help will be truly appreciated.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [June 14, 2021, 6:24pm UTC](https://discourse.julialang.org/t/problem-with-poisson-distribution-fitting-of-an-array-of-floats-suffstats-is-not-implemented-for-poisson-array-float64-1/62898/2 "2021-06-14T18:24:45Z")

</div>

I think `fit(Poisson, data)` expects your data to be Boolean or 0/1 integers:

```julia
julia> using Distributions

julia> fit(Poisson, rand(0:1, 100))
Poisson{Float64}(λ=0.56)

julia> fit(Poisson, rand([0.0, 1.0], 100))
ERROR: suffstats is not implemented for (Poisson, Vector{Float64}).

```

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [June 14, 2021, 6:38pm UTC](https://discourse.julialang.org/t/problem-with-poisson-distribution-fitting-of-an-array-of-floats-suffstats-is-not-implemented-for-poisson-array-float64-1/62898/3 "2021-06-14T18:38:00Z")

</div>

The support of Poisson is natural numbers so any positive integers will do. You could use `round.(Int, derivadas_reales_desplazado)` to convert to Int but if your numbers are float between 0 and 1 that doesn’t make much sense, and you probably want to use another distribution (e.g. Beta).

---

<div class="post-metadata">

**Author:** ![AndresCasillas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrescasillas/32/27133_2.png) [@AndresCasillas](https://discourse.julialang.org/u/AndresCasillas)\
**Post date:** [June 14, 2021, 10:06pm UTC](https://discourse.julialang.org/t/problem-with-poisson-distribution-fitting-of-an-array-of-floats-suffstats-is-not-implemented-for-poisson-array-float64-1/62898/4 "2021-06-14T22:06:20Z")

</div>

Right! Than you very much.
