Aim: To test whether there is significant difference between sample mean and population mean.

Problem:
Suppose the manufacturer claims that the mean lifetime of a light bulb is more than 10,000 hours.
In a sample of 30 light bulbs, it was found that they only last 9,900 hours on average. Assume the
population standard deviation is 120 hours. At 0.05 significance level, can we reject the claim by
the manufacturer?

R code:-
The null hypothesis is that μ ≥ 10000.
Alternative hypothesis is
We begin with computing the test statistic.
>xbar=9900 #sample mean
> mu0=10000 #hypothesized value
>sigma=120 #population standard deviation
> n=30 #sample size
> z=abs((xbar-mu0)/(sigma/sqrt(n)))
>z# test statistic
[1] 4.564355
We then compute the critical value at .05 significance level.
>alpha=0.05
>z.alpha=qnorm(1-alpha)
>z.alpha
[1]1.644854
> sem=sigma/sqrt(n);sem
[1] 21.9089
> E=qnorm(0.975)*sem;E
[1] 42.94066
> xbar+c(-E,E)
[1] 9857.059 9942.941