TU Wien:Statistik und Wahrscheinlichkeitstheorie UE (Levajkovic)/Übungen 2023W/HW05.5

Aus VoWi
Zur Navigation springen Zur Suche springen
Cars arrivals

Suppose cars arrive at a parking lot at a rate of 50 per hour. Assume that the process is modeled by a Poisson random variable with .

(a)  Compute the probability that in the next hour the number of cars that arrive at this parking lot will be between and including 54 and 62.
(b)  Compare the value obtained in (a) with the probability calculated by using a Normal approximation.
Dieses Beispiel ist als solved markiert. Ist dies falsch oder ungenau? Aktualisiere den Lösungsstatus (Details: Vorlage:Beispiel)


Lösungsvorschlag von Friday[Bearbeiten | Quelltext bearbeiten]

--Friday Sa 30 Jan 2021 17:01:33 CET

# Statistics and Probability HW #5
# Friday 
# Duedate: 09.11.2020

# Problem 3 - Cars arrivals
# Suppose cars arrive at a parking lot at a rate of 50 per hour. Assume that 
# the process is modeled by a Poisson random variable with λ = 50.
l <- 50

# Problem 3a)
# Compute the probability that in the next hour the number of cars that arrive 
# at this parking lot will be between and including 54 and 62.
result_3a <- ppois(62, l) - ppois(54-1, l)
result_3a

# Problem 3b)
# Compare the value obtained in (a) with the probability calculated by using a 
# Normal approximation.
normal_approx <- function(a, b, l, correction=FALSE) {
  if (correction) {
    a <- a - 0.5
    b <- b + 0.5
  }
  pnorm((b-l)/sqrt(l)) - pnorm((a-l)/sqrt(l))
}

result_3b <- normal_approx(54, 62, l, TRUE)
result_3b

Lösungsvorschlag von Simplex[Bearbeiten | Quelltext bearbeiten]

# a)
lambda <- 50
res3a <- ppois(62, lambda) - ppois(53, lambda)
print(res3a)
# Output: [1] 0.2616838

# b)
res3b_with_correction <- pnorm(62 + 1/2, lambda, sqrt(50)) - 
    pnorm(54 - 1/2, lambda, sqrt(50))
print(res3b_with_correction)
# Output: [1] 0.271759

--Simplex 14:14, 3. Feb. 2023 (CET)