# Sampling Distribution:
# In class, we have seen the mathematical derivation of the mean and variance
# of the sampling distribution of a statistic; the two statistics we have
# discussed have been 1) sample mean and 2) sample proportion. Here you will
# confirm that the equations given in the lecture are correct,
# by actually performing the thought experiment that went into the
# mathematical derivations. We will also address other statistics, e.g. median.
# One important thing to keep in mind is this: The sampling distribution of
# a sample statistic has nothing to do with data. It is a mathematical
# quantity that one can compute, given some distribution (for the population).
# That's why the formulas are all written in terms of the E[ ] and V[ ],
# i.e., quantities that can be computed given some distribution, p(x).
# By contrast, everything we do below is based on data - data we take
# from a population. As a result, E[] is replaced with the sample mean.
# This is why, the sampling distribution we build, below, is often called
# the *empirical* sampling distribution.
Technically, it's an approximation
# to the true sampling distribution.
# 1) Sampling distribution of the sample mean, when population is normal.
# Type the following block into a script window, because you'll need to
# run it again, with some numbers changed.
###
Set up a normal population. This block is on the web:
# http://www.stat.washington.edu/marzban/390/lab6_supp.txt
rm(list=ls(all=TRUE))
# This erases everything in memory.
set.seed(1)
# This assures we all get same answer.
N = 100000
# Let N be the population size.
pop= rnorm(N,1,2)
# Take a random sample and treat it as pop.
pop.mean=mean(pop)
# This is mu, the pop mean.
pop.sd=sd(pop)

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
This is the end of the preview.
Sign up
to
access the rest of the document.