Part 1

a.

The bell-shaped, symmetrical curve of the normal distribution, sometimes referred to as the Gaussian distribution or the bell curve, is a continuous probability distribution. The distribution of continuous random variables is frequently modeled in probability theory and statistics. A normal distribution is characterized by two parameters, the mean and the standard deviation, and is characterized by data that is centered around a mean (average) value.

A discrete probability distribution known as the binomial distribution predicts the number of successes in a set number of independent, identical trials, where each trial has just two possible outcomes: success or failure. These tests are frequently called Bernoulli tests. The chance of success (p) and the total number of trials (n) are the two factors that define the binomial distribution.

Another discrete probability distribution, the Poisson distribution, is used to represent the frequency of events that happen randomly and seldom over a specified period of time or place. It can be described by a single parameter, sometimes written as (lambda), which stands for the average rate of event occurrence throughout the specified timeframe.

PDF (Probability Density Function) and CDF (Cumulative Distribution Function) are basic concepts in probability and statistics that describe the characteristics of probability distributions. Probability Density Function PDF usually denoted f(x), represents the probability that a continuous random variable takes a specific value within a given range. In other words, the PDF tells you the relative likelihood of observing a particular value of a random variable. The integral of the PDF over a specific interval provides the probability that the random variable falls within that interval. For a continuous random variable, the area under the PDF curve over a range is the probability that the random variable takes a value within that range.The PDF must satisfy two properties: it must be nonnegative (f(x) ≥ 0) and integrate to 1 over the entire range of the variable.

Cumulative distribution function CDF usually denoted F(x), gives the probability that a random variable is less than or equal to a specified value x. Mathematically, the CDF is defined as F(x) = P(X ≤ x), where X is a random variable. The CDF is a non-decreasing function that starts at 0 at negative infinity and approaches 1 as the random variable value approaches positive infinity. It provides a comprehensive view of the distribution by showing the accumulation of probabilities as you move along the range of the variable. In summary, PDF provides the probability density at a specific point, while CDF provides the cumulative probability to a certain point. These two functions are crucial to understanding and characterizing the behavior of random variables in probability and statistics.

Therefore, when the mean (μ) is equal to 0 and the standard deviation (σ) is equal to 1, the PDF of the standard normal distribution is meaningful, and the calculation formula is as follows: f(x) = (1 / (σ * √(2π))) * e ^(-((x - μ)^2) / (2σ^2))

The mean and standard deviation are the two most important factors in a normal distribution. R-style declaration The dnorm, pnorm, qnorm, and rnorm functions are frequently used in R when working with the normal distribution. The mean and standard deviation are two of the arguments that these functions accept.

The chance of success (p) and the total number of trials (n) are the two main parameters for a binomial distribution. We can use R’s dbinom, pbinom, qbinom, and rbinom functions to work with the binomial distribution. The likelihood of success and the quantity of trials are arguments for these functions. As an illustration, the formula dbinom(k, size = n, prob = p) determines the likelihood of obtaining precisely k successes out of n trials with a success chance of p.

The average rate of event occurrence, or lambda, is the most important Poisson distribution characteristic. R declaration to work with the Poisson distribution in R, use the dpois, ppois, qpois, and rpois functions. The average rate (lambda) is an argument for these functions. The chance of observing precisely x occurrences in a Poisson distribution with an average rate.

It is frequently possible to represent measurement mistakes using a normal distribution in scientific research or quality control procedures. A population’s heights typically follow a normal distribution. A mean and standard deviation can be used to model the height distribution.

A binomial distribution can be used to predict how many times a fair coin will land on its head in a series of flips (with a 50% chance of either heads or tails).

A Poisson distribution can be used to represent the frequency of uncommon events, such as accidents at intersections, over the course of a day. A Poisson distribution can be used to model the number of consumers who arrive at a store or call center during a specific time period.

# Generate a sequence of values for x
x <- seq(-3, 3, by = 0.1)

# Calculate PDF and CDF for a standard normal distribution
pdf_values <- dnorm(x)
cdf_values <- pnorm(x)

# Plot the PDF
plot(x, pdf_values, type = "l", col = "blue", xlab = "x", ylab = "PDF",
     main = "PDF and CDF of Standard Normal Distribution")

# Plot the CDF
lines(x, cdf_values, type = "l", col = "red")

# Add a legend
legend("topright", legend = c("PDF", "CDF"), col = c("blue", "red"), lty = 1)

Part 2

Poisson

# Estimate the Poisson rate
N <- 100
lambda <- N * pi

# Probability of observing x or more deaths in a Poisson distribution
p_poisson <- 1 - ppois(x - 1, lambda)

# Output
p_poisson
##  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Binomial

## B.  Model as a Binomial (# .371)
### P(X>=5 errors | n = 2000, p= .002) = 1-P(Y<=4) = 1-pbinom(4,2000,.002)

sum(dbinom(5:2000,size = 2000,prob = .002))           # brute force
## [1] 0.371163
1 - pbinom(4,2000,.002)                 # adjust for discrete variable !!! 
## [1] 0.371163
pbinom(4,2000,.002,lower.tail=F)        # adjust for discrete variable !!!  
## [1] 0.371163
# Parameters
N <- 100
x <- 10
pi <- 0.05

# Probability of observing x or more deaths in N trials
p_binom <- 1 - pbinom(x - 1, size = N, prob = pi)

# Output
p_binom
## [1] 0.02818829

We got 0.03182806 is similar to 0.02818829, because the binomial and Poisson distributions should yield similar results when the number of trials (N) is large, and the probability of success (π) is small. In this case, both distributions can be used to approximate the same event. However, for large N and small π, the Poisson distribution is often more computationally efficient.

In our example, both approaches should yield similar results because N is relatively large (100) and π is relatively small (0.05). The probability values from both distributions can be used to assess whether the hospital’s proportion of deaths is more extreme than the national proportion. If the probability is low, it suggests that the hospital’s proportion of deaths is significantly different from the national proportion. If the probability is high, it suggests that the hospital’s proportion is not significantly different.