Confidence with Known Standard Deviation

## Description

To estimate of the average length of a great white shark from our sample of 44 sharks, Sage can calculate a confidence interval for the population mean using R. We assume that the distribution of the lengths of great white sharks is approximately normal with known standard deviation $\sigma = 2.55$ feet.

To use R in a Sage cell, the language must be set to R. See https://github.com/sagemath/sagecell/blob/master/doc/embedding.rst for details.

## Sage Cell

#### Code

sharks <- c(18.7, 16.4, 13.2, 19.2, 12.3, 16.7, 15.8, 16.2, 18.6, 17.8, 14.3, 22.8, 16.4, 16.2, 16.6, 16.8, 15.7, 12.6, 9.4, 13.6, 18.3, 17.8, 18.2, 13.2, 14.6, 13.8, 13.2, 15.7, 15.8, 12.2, 13.6, 19.7, 14.9, 15.2, 15.3, 18.7, 17.6, 14.7, 16.1, 13.2, 12.1, 12.4, 13.5, 16.8)
xbar = mean(sharks)     # sample mean
sigma = 2.55            # population standard deviation
n = length(sharks)      # sample size
sem = sigma/sqrt(n)     # standard error of the mean
E = qnorm(.975)*sem     # margin of error, 95% confidence level implies 97.5% of the normal distribution in the upper tail
xbar + c(-E, E)         # confidence interval

None

## Tags

Primary Tags: Statistics: Confidence intervals

Secondary Tags: Confidence intervals: One sample mean - z