Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to compute the probability of Poisson distribution in julia

Tags:

julia

I have to compute the probability of Poisson distribution in Julia. I just know how to get Poisson distribution. But i have to compute the probability. also i have lambda from 20 to 100.

using Distributions    
Poisson()
like image 1000
user3582228 Avatar asked Feb 05 '23 05:02

user3582228


1 Answers

The objects in Distributions.jl are like random variables. If you declare a value to be of a distribution, you can sample from it using rand, but there are a whole lot of other methods you can apply to it. Among them is pdf:

julia> X = Poisson(30)
Distributions.Poisson{Float64}(λ=30.0)

julia> pdf(X, 2)
4.2109303359780846e-11

julia> pdf(X, 0:1:10)
11-element Array{Float64,1}:
 9.35762e-14
 2.80729e-12
 4.21093e-11
 4.21093e-10
 3.1582e-9  
 1.89492e-8 
 9.47459e-8 
 4.06054e-7 
 1.5227e-6  
 5.07567e-6 
 1.5227e-5  
like image 146
phipsgabler Avatar answered May 24 '23 04:05

phipsgabler