**Question**

The mean safety audit score of ACME Co. stores in New York (n=200) was 74.3pts February last year. Suppose we decided to sample 22 out of the 200 stores one year later. We find that the sample mean is 78.6pts and the sample standard deviation is 3.2pts. Can we reject the null hypothesis that the sample mean score does not differ from last years true mean? That is to say can we prove that this sample mean is indicative of the population and is explained by probability.

Null hypothesis of a two-tailed test of the population mean is: \[\mu=\mu_{0}\]

where $$\mu_{0}$$ is the hypothesized value of the true population mean $$\mu$$

The test statistic or output of the test (t) is defined by the sample mean ($$\bar{x}$$), size (n), and standard deviation (s).

`$$!t=\frac{\bar{x}-\mu_{0}}{s /\sqrt{n}}$$`

[sourcecode language=”r”]

xbar <- 78.6 # sample mean

mu0 <- 74.3 # hypothesized val

s <- 3.2 # Sample stdev

n <- 22 # Sample size

t <- (xbar-mu0)/(s/sqrt(n))

t # test statistic

[1] 6.302746

[/sourcecode]

Now to compute the range for the .05 significance level:

[sourcecode language=”r”]

a <- .05 #Alpha (significance level)

t.half.a <- qt(1-a/2, df=n-1)

c(-t.half.a, t.half.a)

[1] -2.079614 2.079614

[/sourcecode]

**Solution**

T, our test statistic of 6.302746 does not lie between the range of -2.079614, and 2.079614. This means we can reject the null hypothesis that the mean score does not differ from last year.

Thanks to zhiqiang for the great WP LaTeX plugin and to Alex for SyntaxHighlighter Evolved.