# R-help to exercise 2 in BSS
# Read the data into R and look at the data:
speed<-scan("http://www.math.uio.no/avdc/kurs/STK4900/data/exer2.dat")
speed
# QUESTION a)
# Plot the data in various ways:
hist(speed)??? ??????????????? # histogram
boxplot(speed)? ?????????? # box plot
stem(speed) ???????????????? #stem-and-leaf plot
# What do the different plots tell you?
# Are there indications for "outliers" in the data?
# QUESTION b)
# Compute the (empirical) mean and the median, which are the two most common measures of location
# (alternatively you may use the command summary(speed) to compute the mean and the median)
mean(speed)???????????????? #mean
median(speed)????????????? #median
# What do the two measures of location tell you?
# Compute the (empirical) standard deviation and the interquartile range, which are two common measures of spread:
sd(speed)???????????????????? #standardavvik
IQR(speed)????????????????? #kvartildifferanse
# What do the two measures of spread tell you?
# QUESTION c)
# Compute t-based confidence interval using all data:
t.test(speed)
# Compute t-based confidence interval without the two "outliers":
t.test(speed[speed>0])
# What do the two intervals tell you? Which one do you find most reasonable?