TU Wien:Statistik und Wahrscheinlichkeitstheorie UE (Bura)/Übungen 2020W/HW06.6

Aus VoWi
Zur Navigation springen Zur Suche springen

N(0,1)-distribution and neighborhoods[Bearbeiten | Quelltext bearbeiten]

  • (a) Plot the density of the N(0,1) distribution.
  • (b) Which quantiles of N (0, 1) mark the neighborhoods of zero that contain first 95%, second

99% and third 99.9% of the probability mass? Which values do they take? (c) Add these neighborhoods to your plot.

Hint: plot(), qnorm()

Lösungsvorschlag von Friday[Bearbeiten | Quelltext bearbeiten]

--Friday Sa 30 Jan 2021 17:15:00 CET

# Statistics and Probability HW #6
# Friday 
# Duedate: 16.11.2020

# Problem 6 - N(0,1)-distribution and neighborhoods

# Problem 6a)
# Plot the density of the N(0,1) distribution.
x=seq(-4,4,0.01)
y=dnorm(x, 0, 1)
plot(x, y, type='l')

# Problem 6b)
# Which quantiles of N (0, 1) mark the neighborhoods of zero that contain first 
# 95%, second 99% and third 99.9% of the probability mass? 
# Which values do they take?
result_6b = c(qnorm(0.95,0,1), qnorm(0.99,0,1), qnorm(0.999,0,1))
result_6b

# Problem 6a)
# Add these neighborhoods to your plot.
abline(v=result_6b, col=c("lightblue", "red", "lightgreen"))
legend("topleft", legend=c("95%", "99%", "99.9%"), 
       col=c("lightblue", "red", "lightgreen"), lty=1, cex=0.8)