In this video we're going to learn a little bit about how samples behave.
We need to learn a little bit about how samples behave in order to be able to
take a sample and generalize back to a population.
In statistical analysis, we will use a sample to try and make statements about a population but the
sample that we get won't always look exactly like the population, so we need
to learn a bit about how different might it look so that we can incorporate this
into our procedure for making statements about a population which we call
statistical inference; as an example let's consider drawing samples from a
normal distribution that has a mean of 150 and a standard deviation of 40,
Here we're looking at a population where we know the exact mean, standard
deviation and shape of the distribution; first we're going to look at doing this
using R (Software) and running some simulations and then we're going to look at it using a
web visualization tool. First I'm going to have R make a plot of this normal distribution
so we can see this is the true or theoretical distribution that
we're going to draw samples from. I'm going to start by taking a sample of 20
out of this population so we're gonna let R (Statistical Software) know we'd like to take a sample of
size 20, here I'm going to ask R to draw a sample from a normal distribution
of size 20 and the normal has a mean of 150 a standard deviation of 40; and then
I'm going to ask R to give us a histogram of these 20 observations. Now
taking a look at this here you might be tempted to say this data does not look
normally distributed but because we're in a kind of artificial simulation
environment here we know that these 20 observations came from a population that
was perfectly normally distributed with a mean of 150, standard deviation of 40
let's also take the mean of our sample here we can see it came out to be 146.66
and again we know at the population these individuals were drawn
from a population that has a true mean of 150; let's take a look at our sample
standard deviation came out to be 34.96 and again we know that at
the population level these 20 individuals came from a population that
has a standard deviation of 40. So this gave us an a little bit of an idea of
how our sample varied from the true values; let's just take a look at doing
that again. To do so I'm just going to re-submit this code asking R to take
another sample of 20 from this population. We can see the histogram here
again this came from a population that is normally distributed we can see a
sample mean of 163.6, sample standard deviation of 39.7
Let's ask R to do this again. Again looking at this histogram well it
may not look or you may not want to say that this looks normally distributed we
know that it came from a normal distribution sample mean of 149 sample
standard deviation of 40. Let's ask R to draw another sample of 20 again this
data came from a normal that one actually looks a little bit more like
what we might call normal let's ask R for one more again this data came from a
normal distribution we can think of what happens if we increase the sample size
so let's ask R to draw samples of size 50 from this population so I've
increased n up to 50 and now I'm going to ask R to draw a sample of 50 from
this population make a histogram calculate the sample mean and sample
standard deviation; again these 50 observations came from a normal
distribution we know that sample mean of 157 sample standard deviation of 43
let's look at doing this a few more times grab another sample of 50 take a
look at the histogram sample mean and sample standard deviation let's do that
one more time again this data came from a normal distribution and one more so
again people might be the first time taking an intro stats course or I guess
less trained eye might look at a histogram like this and be tempted to say that it
looks skewed to the left or negatively skewed where in fact we know that this
data came from a normal distribution: a perfectly bell-shaped and symmetric
population so I'll leave this with you you can take this R-script and you can
try playing around with different sample sizes increase it to 100, 200 whatever
you like and see how the sample estimates change.
Now let's take a quick look at the same sort of example using a web visualization so using a slightly
nicer looking version or different looking version of the same exercise.
Here we can see we have this set up to draw samples of size 20 from a
population that has a mean of 150 standard deviation of 40 and if we ask
to show the population we can see that at the population level the distribution
is perfectly bell-shaped and symmetric or normal! okay I'm going to hide that
now let's ask it to draw a sample of 20 for us and we can see taking a look at
the histogram here while you may or may not be tempted to call this normally
distributed we know that it came from a normally distributed population let's
take a look at doing that again so I'm going to get another sample of 20
observations again this data here came from a normally distributed population
now you can play around with it if you want you can try increasing the sample
size seeing how the sample estimates vary. Let's quickly let's go up to a
large sample let's take 100 and see what it looks like here's our sample
of 100 observations this one doesn't look too bad but either way
we're in this kind of simulation world where we know at the population level
this data is normally distributed let's take a look at drawing one more sample
of 100; well that one looks pretty good so over the course we're going to
formalize these ideas a bit more mathematically we're going to get a more
exact understanding of how samples vary from the true or population value in the
mean time you can play around with these for the moment to get a bit more
intuitive understanding of how samples vary you can find the R script that I've
used in this video as well as a link to this web visualization in the video
description below. Make Sure to Subscribe to Marinstatlectures!