6 Inference
Previously, we learned how to generate random variables according to many different distributions. And we also learned two important theorems – the law of large numbers (LLN) and the central limit theorem (CLT). Now in this chapter, we will learn how to reach statistical conclusions based on a given dataset.
Learning Objectives
- Learn how to calculate and interpretate confidence intervals based on the dataset.
- Learn how to perform a hypothesis test, including one-sample test, two-sample test, and a test for proportions.
- Learn how to perform a chi-squared test.
Useful Functions
Use
z.test()
to calculate confidence intervals when population standard deviation is known.Use
t.test()
to calculate confidence intervals when population standard deviation is not known.Use
prop.test()
to get approximate result for tests for proportions.- Use
binom.test()
to get exact result for tests for proportions only applied for one-sample questions. Use
power.z.test()
to calculate the critical value where we would reject the null if we observe data more extreme than that.Use
chisq.test()
to test for dependence between the row and column variables.