(USING RSTUDIO) a) The following data contains observations on the body temperatures (in degrees Celsius) of a beaver in north-central Wisconsin (note that there is no “header” in this file since it only contains a single variable). Using an asymptotic approximation, form a 95% confidence interval for the mean beaver body temperature.
b) Refer to the previous question. Use this data to plot the ECDF of beaver body temperatures. Next, overlay a plot of the normal CDF with mean ˆμn and standard deviation ˆσn (HINT: In R, pnorm(x) produces the CDF of the standard normal distribution at point x, while pnorm (x,m,s) produces the CDF of the normal distribution with mean m and standard deviation s at point x. In other words, pnorm(x) and pnorm (x,0,1) produce the same thing.)
36.33 36.34 36.35 36.42 36.55 36.69 36.71 36.75 36.81 36.88 36.89 36.91 36.85 36.89 36.89 36.67 36.5 36.74 36.77 36.76 36.78 36.82 36.89 36.99 36.92 36.99 36.89 36.94 36.92 36.97 36.91 36.79 36.77 36.69 36.62 36.54 36.55 36.67 36.69 36.62 36.64 36.59 36.65 36.75 36.8 36.81 36.87 36.87 36.89 36.94 36.98 36.95 37 37.07 37.05 37 36.95 37 36.94 36.88 36.93 36.98 36.97 36.85 36.92 36.99 37.01 37.1 37.09 37.02 36.96 36.84 36.87 36.85 36.85 36.87 36.89 36.86 36.91 37.53 37.23 37.2 37.25 37.2 37.21 37.24 37.1 37.2 37.18 36.93 36.83 36.93 36.83 36.8 36.75 36.71 36.73 36.75 36.72 36.76 36.7 36.82 36.88 36.94 36.79 36.78 36.8 36.82 36.84 36.86 36.88 36.93 36.97 37.15
Before any calculations on the data, import the data in Rstudio :
Go to FIle -> Import DataSet. You can choose the file after copying the above data in a .txt file. The data will be imported into a data.frame with a single variable.
The sample mean and sample std. deviation of beaver body temperatures can be found using the following R commands (assuming the data frame name is "bodytemp" and the field name is "V1"):
mu <- mean(bodytemp$V1)
sig <- sd(bodytemp$V1)
Once we havethese values, the 95 percent confidence interval can be given as

where
is mu,
is
sig and
is the size
of our data (114 in this case)
Coming to the (b) part,
The following commands help plotting the Experical Cumulative Distribution Function
data <- bodytemp$V1
f_ecdf <- ecdf(data)
plot(f_ecdf)
And using
fr = pnorm(sort(data), mean(data), sd(data))
we get the CDF of a normal distribution with our sample mean and SD
Following commands can be used to plot with overlay :
> plot(sort(data), fr) > par(new=TRUE) > plot(sort(data), fn(sort(data)), type="l")
(USING RSTUDIO) a) The following data contains observations on the body temperatures (in degrees Celsius) of...