The uniform distribution is a symmetric probability distribution where all outcomes have an equal likelihood of occurring. All values in the distribution have a constant probability, making them uniformly distributed. This distribution is also known as the rectangular distribution because of its shape in probability distribution plots. Uniform distributions come in both discrete and continuous distributions.
The Bernoulli distribution is a discrete probability distribution that models a binary outcome for one trial. Use it for a random variable that can take one of two outcomes: success or failure, much like a coin toss. Bernoulli distribution is one of the simpler discrete distributions. It is a starting point for more complex distributions that model a series of trials, such as the binomial, geometric, and negative binomial distributions—critical players in statistics.
The exponential distribution is a right-skewed continuous probability distribution that models variables in which small values occur more frequently than higher values. Statisticians use the exponential distribution to model the amount of change in people’s pockets, the length of phone calls, and sales totals for customers. In all these cases, small values are more likely than larger values.
PDF is the probability that a random variable (let X), will take a value exactly equal to the random variable (X). The value lies between 0 and 1.
A continuous random variable X has a uniform distribution, denoted U(a,b), if its probability density function is: f(x) = 1/b-a for two constants a and b, such that a < x < b.
The PMF of a Bernoulli distribution is P(X = x) = px(1−p)1−x, where x can be either 0 or 1.
PDF of Exponential distribution is fX(x)={λe−λx0x>0
CDF is the probability that a random variable (let X) will take a value less than or equal to the random variable (X). It is for continuous and discrete random variables. The value of CDF is always non-negative.
CDF of uniform random variable X is f(x) = x-a/b-a for two constants a and b, such that a < x < b.
The CDF of Bernoulli distribution is 0 if x < 0, 1−p if 0 ≤ x < 1, and 1 if x ≥ 1.
C. Key parameters for Unifrom, bernoulli and exponential distribution :
There are two parameters for uniform distribution which is a and b. The minimum value, a, is the lower bound, and 0<a<b. The maximum value, b, is the upper bound, and a<b<infintiy. In R dunif, punif, runif parameters are declared.
The parameters ‘p’ in the bernoulli distribution is given by the probability of a “success”.
The Exponential distribution has two parameters scale and thresold parameters. In R dexp, pexp, qexp parameters are declared.
D. Examples for distributions :
The situations that can be modeled by uniform distribution, when each discrete value is equally likely to occur.
Examples : Birthday Guessing : Try to guess his/her birthday. In the every year, it has equal chances of being his/her birthday
Lucky Draw Contest : In this examples ecah and every person have equal winning chances in the contest, So it is a uniform distribution.
The Bernoulli distribution having two outcomes.
Examples : A team will win a match or not.(Two Outcomes) A flip coin has two outcomes Head and Tail. A student will pass or fail in exam.
The time spent waiting between events is often modeled using the exponential distribution.
Examples : Call Duration : The average amount of time a person accesses a public telephone for conversation is about fifteen minutes. In this case, Exponential distribution find out the probability that the person standing ahead of you.
Life span of Electronic gadgets : Exponential distribution find life span of gadgets. It helps the engineer to know an approximate time after the product will get ruptured.
E.Plot Distribution own examples :
#Plot Unifrom Distribution
# Set the seed for reproducibility
set.seed(456)
# Define the range of possible outcomes
start <- 0 # Start of the range
end <- 10 # End of the range
# Generate a sample of random numbers from the uniform distribution
sample_size <- 50
uniform_numbers <- runif(sample_size, min = start, max = end)
# Create x-coordinates for the scatter plot
x <- 1:sample_size
# Plotting the scatter plot of the generated sample
plot(x, uniform_numbers, type = "n", xlab = "Index", ylab = "Value",
main = "Uniform Distribution")
points(x, uniform_numbers, pch = 16, col = "blue")
#This will result in a scatter plot where each point represents a randomly generated value from the uniform distribution, with the x-coordinate indicating the index and the y-coordinate representing the value.
# Set the seed for reproducibility
set.seed(987)
# Define the probability of success (p)
p <- 0.3
# Generate a sample of random numbers from the Bernoulli distribution
sample_size <- 100
bernoulli_numbers <- rbinom(sample_size, size = 1, prob = p)
# Calculate the frequencies of 0s and 1s
frequency <- table(bernoulli_numbers)
# Plotting the bar plot of the generated sample
barplot(frequency, names.arg = c("0", "1"),
xlab = "Outcome", ylab = "Frequency", main = "Bernoulli Distribution")
#This will result in a bar plot representing the Bernoulli distribution, with one bar for the frequency of 0 outcomes and one bar for the frequency of 1 outcomes.
# Set the seed for reproducibility
set.seed(456)
# Define the rate parameter (lambda)
lambda <- 0.5
# Generate a sample of random numbers from the exponential distribution
sample_size <- 1000
exponential_numbers <- rexp(sample_size, rate = lambda)
# Plotting the density plot of the generated sample
plot(density(exponential_numbers), xlim = c(0, 10),
xlab = "Value", ylab = "Density",
main = "Exponential Distribution")
#This will result in a density plot representing the exponential distribution, with the x-axis representing the values and the y-axis representing the density.
Let’s assume that a hospital’s neurosurgical team performed N procedures for in-brain bleeding last year. x of these procedures resulted in death within 30 days. If the national proportion for death in these cases is pi, then is there evidence to suggest that your hospital’s proportion of deaths is more extreme than the national proportion?
Pick your own values of N, x, and pi. x is necessarily less than or equal to N, and pi is a fixed probability of success.The probability should be greater than or equal to x. Assume N =30, x = 5, pi = 0.5 A. Then model both as a binomial and a Poisson, and provide your R code solutions.
#Binomial Model :
#Let assume
choose(n = 30, k = 5) * 0.5^5 * (1-0.5)^(30-5)
## [1] 0.0001327191
N <- 30
K <- 5
pi <- 0.5
choose(n = N, k = K) * pi^K * (1-pi)^(N-K) # gives same answer as above
## [1] 0.0001327191
# Again, gives same answer as above
dbinom(x = 5,
size = 30,
prob = 0.5
)
## [1] 0.0001327191
1 - pbinom(4,30,0.5)
## [1] 0.9999703
# Mean of Binomial
#N * pi
30 * 0.5
## [1] 15
#Variance of Binomial
#size * prob * (1-prob)
30 * 0.5 * 0.5
## [1] 7.5
#Model of Poisson
dpois(x = 4,
lambda = 15)
## [1] 0.0006452627
ppois( q = 4, # discrete variable adjustment - read lower tail argument specification P[X≤x]
lambda = 15,
lower.tail = TRUE
)
## [1] 0.0008566412
ppois( q = 4, # discrete variable adjustment - read lower tail argument specification P[X>x]
lambda = 15,
lower.tail = FALSE
)
## [1] 0.9991434
hist(rpois(n = 30,
lambda = 15)
) # mean of poison
sum(dbinom(x=5:30,
size= 30,
prob= 0.5)
)
## [1] 0.9999703
pbinom(q = 4 ,
size = 30,
prob = 0.5,
lower.tail = F
)
## [1] 0.9999703
1 - ppois(q = 4,lambda = 15,lower.tail=T)
## [1] 0.9991434