This week's topics covered confidence intervals and an introduction to the fundamentals of hypothesis testing, as finding the required sample size for a sound experiment.

### Question # 1 : x̄ = 85 and σ = 8, and n = 64, set up a 95% confidence interval estimate of the population mean μ.

```> xhat <- 85
> sd <- 8
> n <- 64
> z <- 1.96
> me <- z*(sd/sqrt(n))
> upper <- xhat + me
> lower <- xhat - me
> cat("It can be claimed with 95% confidence that
the population mean lies between: ", lower, "
and ", upper,".")

It can be claimed with 95% confidence that the
population mean lies between:  83.04  and  86.96.
```

### Question # 2 : If x̄ = 125, σ = 24 and n = 36, set up a 99% confidence interval estimate of the population mean μ.

```> xhat <- 125
> sd <- 24
> n <- 36
> z <- 2.58
> me <- z*(sd/sqrt(n))
> upper <- xhat + me
> lower <- xhat - me
> cat("It can be claimed with 99% confidence that
the population mean lies between: ", lower, "
and ", upper,".")

It can be claimed with 99% confidence that the
population mean lies between:  114.68  and  135.32.
```

### Question # 3 : The manager of a supply store wants to estimate the actual amount of paint contained in 1-gallon cans purchased from a nationally known manufacturer. It is known from the manufacturer's specification sheet that standard deviation of the amount of paint is equal to 0.02 gallon. A Random sample of 50 cans is selected and the sample mean amount of paint per 1 gallon is 0.99 gallon.

1. #### Set up a 99% confidence interval estimate of the true population mean amount of paint included in 1-gallon can.

```> xhat <- 0.99
> sd <- 0.02
> n <- 50
> z <- 2.58
> me <- z*(sd/sqrt(n))
> upper <- xhat + me
> lower <- xhat - me
> cat("It can be claimed with 99% confidence that
the population mean lies between: ", lower, "
and ", upper,".")

It can be claimed with 99% confidence that the
population mean lies between:  0.9827027  and  0.9972973.
```
1. #### On the basis of your results, do you think that the manager has a right to complain to the manufacturer? Why?

```Based on the results from problem 3a given the
random sample, the manager does not have much
reason to complain.
The sample mean lies within the population mean
projection of being between 0.98 and 0.99 with
a relatively low standard deviation of 0.2,
so they should be satisfied with the manufacturer's
quality standards.
```

### Question # 4 : A stationery store wants to estimate the mean retail value of greeting cards that has in its inventory. A random sample of 20 greeting cards indicates an average value of \$1.67 and standard deviation of \$0.32

1. #### Assuming a normal distribution set up with 95% confidence interval estimate of the mean value of all greeting cards stored in the store's inventory.

```> xhat <- 1.67
> n <- 20
> sd <- 0.32
> z <- 1.96
> me <- z*(sd/sqrt(n))
> upper <- xhat + me
> lower <- xhat - me
> cat("It can be claimed with 95% confidence that
the population mean lies between: ", lower, "
and ", upper,".")

It can be claimed with 95% confidence that the
population mean lies between:  1.529754  and  1.810246s.
```
1. #### How might the result obtained in (a) be useful in assisting the store owner to estimate the mean value of all greeting cards in the store's inventory?

```The results from problem 4a indicate that the true population
average of greeting card prices falls between \$1.53 and \$1.81.
This should be an accurate estimate for their purpose of
pricing new cards, however, it may be helpful to run the
test again with a larger sample size possibly including
prices from different stores.
```

### Question # 5 : If you want to be 95% confident of estimating the population mean to within a sampling error of ± 5 and standard deviation is assumed to be equal 15, what sample size is required?

```> z <- 1.96
> sd <- 15
> error <- 5
> n <- ((z*sd)/error)^2
> cat("The required sample size is: ", ceiling(n))
The required sample size is:  35
```

### Question # 6 : Generate your own null and alternative hypothesis statements and provide rationale for your selection.

```Null hypothesis: The average number of years USF
students spend on earning a bachelor's degree is 5

Alternative hypothesis: The average number of years
USF students spend on earning a bachelor's degree is not 5

I chose this example because I think it clearly distinguishes
null from alternative hypotheses. This is an assertion of
a population parameter that can be tested easily.
```