Practice the following exercises to revise the concepts learned in this chapter:
- Write a function that takes a vector and returns the 95 percent confidence interval for that vector. You can return the interval as a vector of length two: the lower bound and the upper bound. Then, parameterize the confidence coefficient by letting the user of your function choose their own confidence level, but keep 95 percent as the default. Hint: the first line will look like this:
conf.int <- function(data.vector, conf.coeff=.95){
- Back when we introduced the central limit theorem, I said that the sampling distribution from any distribution would be approximately normal. Don't take my word for it! Create a population that is uniformly distributed using the
runif
function and plot a histogram of the sampling distribution using the code from this chapter and the histogram-plotting code from Chapter 2, The Shape of Data. Repeat the process using the beta distribution with parameters (a=0.5
,b=0.5...