-
Notifications
You must be signed in to change notification settings - Fork 0
/
_053_poisson_dis.R
executable file
·35 lines (29 loc) · 1.01 KB
/
_053_poisson_dis.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Filename: _053_poisson_dis.R
# Title: Poisson Distribution
# Author: Raghava | GitHub: @raghavtwenty
# Date Created: June 22, 2024 | Last Updated: June 22, 2024
# Language: R | Version: 4.4.0
# Description of functions:
# dpois: Poisson probability mass function (pmf)
# ppois: Poisson distribution cumulative distribution function (cdf)
# qpois: Poisson quantile function
# rpois: Poisson pseudorandom number generation
# Parameters for the Poisson distribution
lambda_param = 10 # Average rate (lambda)
# Define the number of occurrences to consider
occurrences = 30
# Calculate Poisson probabilities for 0 to 'occurrences' number of occurrences
poisson_probabilities = dpois(0:occurrences,
lambda = lambda_param
)
# Display the calculated probabilities
print(poisson_probabilities)
# Plot the Poisson probabilities
plot(0:occurrences, poisson_probabilities,
col = "green",
type = "h",
lwd = 2,
main = "Poisson Distribution (lambda=10)",
xlab = "Number of Occurrences",
ylab = "Probability"
)