TU Wien:Statistik und Wahrscheinlichkeitstheorie UE (Bura)/Übungen 2019W/5.7

Aus VoWi
Zur Navigation springen Zur Suche springen
N(0, 1)-distribution and neighborhoods
(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 Ikaly[Bearbeiten | Quelltext bearbeiten]

a)

x=seq(-3,3,0.01)
y=dnorm(x, 0, 1)
plot(x, y)

b)

q_95 = qnorm(0.95,0,1)
q_99 = qnorm(0.99,0,1)
q_999 = qnorm(0.999,0,1)
q_95
q_99
q_999

c)

abline(v=c(q_95, q_99, q_999), col=c("blue", "red", "green"))

legend("topleft", legend=c("95%", "99%", "99.9%"), col=c("blue", "red", "green"), lty=1:3, cex=0.8)


Lösungsvorschlag von Jeremyer[Bearbeiten | Quelltext bearbeiten]

a)

x=seq(-3,3,0.01)
y=dnorm(x, 0, 1)
plot(x, y)

b)

q_025 = qnorm(0.025,0,1)
q_975 = qnorm(0.975,0,1)

q_005 = qnorm(0.005,0,1)
q_995 = qnorm(0.995,0,1)

q_0005 = qnorm(0.0005,0,1)
q_9995 = qnorm(0.9995,0,1)

c)

abline(v=c(q_025, q_975, q_005, q_995, q_0005, q_9995), col=c("red", "red", "green", "green","blue","blue"))

legend("topleft", legend=c("Contain 95%", "Contain 99%", "Contain 99.9%"), col=c("red", "green","blue"), lty=1:1)