# lab7 - This lab might seem similar to the previous lab and...

This preview shows pages 1–3. Sign up to view the full content.

Sheet1 Page 1 # This lab might seem similar to the previous lab, and it is! # But there are some subtle differences. The main difference is # the emphasis this lab places on the concept of a confidence interval, # and what it is expected/designed to do. # The first task of this lab is to show that the formula for the confidence # interval for the population mean actually does what it is designed to do. # Recall that the formula is # sample.mean +- z_star * sample.sd/root(n) # and it is designed to cover the population mean in 95% of samples taken # from the population. The nontrivial part of this formula is the # sample.sd/root(n), also called the standard error (std err) of the sample mean. # The second task is to show that we can actually get similar answers, # WITHOUT using the formula for the std err of the mean. This is important # when simple formulas for the std err do not exist, e.g., for sample median. # The main idea is called the bootstrap, and it basically treats the single # sample that you have in a realistic situation as if it were the population! # So, instead of sampling from the population (i.e., what we did last time), # bootstrap resamples from the sample. # It's like magic, but you'll see how it works below. # The third task is to actually use the bootstrap idea to build a CI for # the population median, i.e. a situation where simple formulas for the # std. err. of the median do not exist. # Type in a script window, first, because you'll be using similar # lines of code for different purposes. # The final task is to learn about a function in R - called t.test() - # which computes CIs under special conditions (normality, etc.). We'll # learn more about the t.test() in the next lab. ########################################################################## # Cut/paste the following block from # http://www.stat.washington.edu/marzban/390/lab7_supp.txt rm(list=ls(all=TRUE)) N = 100000 # Here is our population. set.seed(1) pop=rgamma(N,2,3) pop.mean=mean(pop) pop.sd=sd(pop) pop.median=median(pop) c(pop.mean,pop.sd,pop.median) hist(pop,breaks=400) # Population is not Normal. Check it out. ############################################################################ ## 1) Build CIs for population mean, using the formula for the std err of mean.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 ## Draw n.trial=100 samples of size sample.size=90 from the population made above. ## We want to confirm that the CI (as computed with our formula) covers the
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

lab7 - This lab might seem similar to the previous lab and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online