Need up to 30 seconds to load.
hi everybody
this is eugene lachlan and welcome to my
series of short how-to videos
in this video we're going to learn how
to calculate the confidence interval for
a sample and we're going to learn how to
do this by hand
so first off let's take a look at the
data that we're going to use in this
example
um i've used this data before in
previous videos these are the data for
14 randomly selected bags of food which
weigh one kilogram or 1 000 grams so
we've randomly selected those
from a production line as part of a
quality control process
and we want to be able to do do some
statistical calculations
with these data so the first thing i've
done with these
sample of 14 here is i've worked out the
sample mean and we can see the sample
mean x bar is equal to 996.21 grams
s is the standard deviation that works
out at 5.65
and n the sample size is 14. so we're
going to need these some of these values
in our later calculations
let's take a look at the t distribution
this is a typical t distribution our
friend the bell shape diagram here and
what we say for 95 percent confidence is
that um if it's bell-shaped like this
then with the
population mean mu in the center here 95
percent of all values
fall between the this area here the vast
majority of the bell
shape and five percent fall uh in
into the left and the right tail so half
of five percent in the left tail and
half of right five percent in the right
tail
so what we need to know here for our
sample size is what is the value what is
the t
value here uh at each of these and
margins at each of the tails so we're
going to need to look those up
in t tables so let's go ahead and do
that first
these are t tables here and they're
widely available online
and there's two things we need to know
we need to know down the left-hand side
here
what the row is and that's based on df
degrees of freedom so we're going to
need to have to work out the degrees of
freedom for our sample size
of 14 and we also then need to know what
what is the confidence level
that we want to do our test at so we're
doing it at 95 percent here
or a value of 0.05 so the degrees of
freedom first of all are straightforward
enough
and the degrees of freedom is equal to n
minus 1 which is equal to in our case 14
minus 1
which is equal to 13. so we have 13
degrees of freedom so let me go and look
this up on the table
so my row here of 13 so somewhere on
this row
if i just highlight the row somewhere on
this row
is my t value now how do i select the
column
well the column is i can do it in two
ways uh one is i can cross the bottom in
this version of a t table look and see
uh 95 here so that'll be in this column
or at the top
i can choose we've got two tails the
value of 0.05
so so somewhere on this column
is going to be my t value and where the
two values cross over
is the t value i'm going to need we can
see that that is 2.160
by the way if you wanted to do a 99 or a
different
value here you would have the same
degrees of freedom in this sample size
but you can see here i would move over
so for example at 99
confidence interval my t value is going
to be 3.012
but we're going to stick with 95
confidence for the moment
so my t value my t
value is equal to
2.160 so that's these values here is
2.160 and minus 2.160 here in the left
tail
now that value is going to become
important in a moment
next we need to be able to work out the
standard error so the standard error
formula our standard error of the mean
is a straightforward formula we're using
the sample standard deviation here
s and divided it by the square root of n
which in our case is 14. so we have the
two values here so let's go ahead and
work this out
so that is equal to a standard deviation
of 5.65
divided by the square root of 14. let me
get my calculator out and work that out
so 5.65 divided by
putting 14 and use the square root
symbol
to get that and then press equals and
that will give me a standard error of
1.51 i'll use two decimal places there
so now we've got the standard error and
our next job then is
to multiply our standard error so we
want to multiply our standard error
multiplied by
our t value so that is equal to
1.51 from here multiplied by
2.160
so let's work that out so we have the
1.51 still in our calculator
multiply that by 2.16
that is equal to 3.8
so now we have the value that we need to
estimate our upper value and our lower
value for the confidence interval
so let me put in the upper one first
and that's going to be equal to my mean
996.21 plus this value that i've just
worked out here
so that's going to be 996.21
plus 3.26 and that's going to be equal
to let me work that out
my calculator so 996.21
plus 3.26 is equal to
so that's 99.99999
and my lower limit for the confidence
interval
is equal to the same mean value again
9996
0.21 minus 3.26 the same value we've
worked out up here
and that is equal to let me work that
out
996.21 minus this time
3.26 which is equal to
two 992.8 nine five so my confidence
interval then for the mean
is my lower limit is um nine nine
um two point nine five up to
my upper limit here 999.47
so i can now say with 95 confidence
that the population mean lies between
these two values
uh if i wanted to do 99 confidence the
only thing that's going to change is
this
um t value over here it will be a higher
value for a 99
confidence and this margin here will
will will
widen so our ci here is
equal to plus or minus 3.2
so that's this value here
now so that's how you calculate the
confidence interval for a sample i hope
you found this video useful
thank you for your attention