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

Aus VoWi
Zur Navigation springen Zur Suche springen

Approximate confidence intervals[Bearbeiten | Quelltext bearbeiten]

Messages are regularly sent from a sender to a receiver. For randomly chosen messages the

transfer times were measured and stored in the file waitingtimes.Rdata.

  • (a)  Represent the data in a histogram. Is the distribution approximately bell-shaped?
  • (b)  Construct an approximate 99%-confidence interval for the expectation and plot it into the graphic.
  • (c)  An engineer claims that the mean transfer time is 1.5 seconds. Are the measurements compatible with this statement?

Lösungsvorschlag von Friday[Bearbeiten | Quelltext bearbeiten]

--Friday Sa 30 Jan 2021 17:30:21 CET

load('waitingtimes.Rdata')
(par(mfrow=c(1,1)))

# 5a)
hist(wz, main="Waitingtimes", xlab="waittime (sec)", col="white")

# The data is not bell-shaped.

# 5b)
n <- length(wz)
m <- mean(wz)
S <- sd(wz)
Sem <- S / sqrt(n)
X <- (1/n) * sum(wz)
q1 = qnorm(0.99)
I <- c(X-(q1*Sem), X+(q1*Sem))

#abline(v=I, col='red')
rect(I[1],0, I[2], 100, density = 10, col='lightgreen')
abline(v=m, col='lightblue', lwd=2)
#rect(0, 0,I[1],100, density = 10, col='pink')
#rect(I[2], 0, 4,100, density = 10, col='pink')

#5c)
t.test(wz, mu=1.5, alternative = 'two.sided', var.equal = F, paired = F, conf.level = 0.99)
# Reject the hypothesis, because p < alpha