# Upper Tail Test of Population Mean with Known Variance

The null hypothesis of the upper tail test of the population mean can be expressed as follows:

where μ0 is a hypothesized upper bound of the true population mean μ.

Let us define the test statistic z in terms of the sample mean, the sample size and the population standard deviation σ :

Then the null hypothesis of the upper tail test is to be rejected if z zα , where zα is the 100(1 α) percentile of the standard normal distribution.

#### Problem

Suppose the food label on a cookie bag states that there is at most 2 grams of saturated fat in a single cookie. In a sample of 35 cookies, it is found that the mean amount of saturated fat per cookie is 2.1 grams. Assume that the population standard deviation is 0.25 grams. At .05 significance level, can we reject the claim on food label?

#### Solution

The null hypothesis is that μ 2. We begin with computing the test statistic.

> xbar = 2.1             # sample mean
> mu0 = 2                # hypothesized value
> sigma = 0.25           # population standard deviation
> n = 35                 # sample size
> z = (xbarmu0)/(sigma/sqrt(n))
> z                      # test statistic
[1] 2.3664

We then compute the critical value at .05 significance level.

> alpha = .05
> z.alpha = qnorm(1alpha)
> z.alpha                # critical value
[1] 1.6449

#### Answer

The test statistic 2.3664 is greater than the critical value of 1.6449. Hence, at .05 significance level, we reject the claim that there is at most 2 grams of saturated fat in a cookie.

#### Alternative Solution

Instead of using the critical value, we apply the pnorm function to compute the upper tail p-value of the test statistic. As it turns out to be less than the .05 significance level, we reject the null hypothesis that μ 2.

> pval = pnorm(z, lower.tail=FALSE)
> pval                   # upper tail pvalue
[1] 0.0089802