- Hello, I am Professor Rick Jerz,
and I welcome you to this topic titled Two Sample Tests.
This topic most commonly follows one sample test
of hypotheses, so you might want to review
the one sample test methods as background.
In this session, we will learn how to test
if the means from two independent samples are the same,
and we will also test that the means
from two dependent samples are the same.
Some of these tests also require that we know
whether the sample variances are the same.
So I will include testing variances in this session.
I should mention that some textbook authors
include tests of variances in different chapters
and extend this topic a little more broadly.
But I find it is best to cover what is needed now
to support the testing of means.
The need to compare two samples happens a lot in life,
so I think that you will use this analysis frequently,
and you will enjoy it too.
Let's get started.
Developing an Excel model that takes into account
these four different two sample scenarios
and also including test of variances
and the various forms of the null hypothesis
that the sample means are equal to,
less than or equal to, or greater than or equal to
was a bit challenging.
Remember that for independent sample scenarios,
the test and calculations are dependent
upon whether or not the population variances
are known or unknown.
When the population variances are unknown,
there are two different tests that we might run
to compare the means based upon whether or not
the variances are equal or unequal.
So in order to compare the means of populations
when the variances are unknown,
we have to compare the variances first
before knowing which test is appropriate for the means.
The way that Microsoft Excel has tried
to handle these varying conditions
in its data analysis tool is to give you
different tests for each different situation.
I provide you one Excel model to do all of these tests,
and you have to answer some questions
which lead you into which part of the model
is appropriate to use.
Let me give you an overview of my Excel model.
If you have the actual raw data,
on the left side of my model,
you can enter in the data for these two samples.
You might note that I have used 'sample1'
and 'sample2' as defined range names.
To the right of these columns,
I calculate the statistics for these samples.
These statistics include the means,
standard deviation, variance, and count.
If you are also provided
the population's standard deviation,
you can enter it here.
In some problems, you will be given
the mean, population standard deviation, and count
instead of the raw data.
When this happens, you should enter
that data in this area.
There may be some problems where you are told
that this is sample data but you are also given
the population standard deviation.
So in this area, you can enter
either the sample or population standard deviation or both.
I should mention that in dependent sample scenarios,
you are almost always provided raw data
and seldom summary statistics.
Now we need to answer some questions.
This question, 'Are you using raw data?'
should be answered 'Yes' if you have entered
the data to the left and answer it 'No'
if you have entered summary statistics
up above in the green area.
The next question is whether or not
you have been given the population variance
or standard deviation.
For independent sample scenarios,
this can be a 'Yes' or a 'No'.
For dependent sample scenarios,
you should always enter a 'No'.
The answer to these two questions
will determine what gets plotted to the right.
This chart to the right is pretty interesting to look at.
It shows the comparison of these two sets
of data by coloring one red and the other one green.
The overlap in the area between these two sets of data
is shown in brown.
The means are shown as solid black lines.
The third question you are asked
is whether or not the null hypothesis
is an 'equal to', 'less than or equal to',
or 'greater than or equal to' test.
In the cell, you must enter an E, L, or G.
If you enter 'equal' in this cell,
you are performing a two-tailed test.
One thing that I do want to mention to you
about this model is that after you enter
an E, L, or G, right below this,
I will show you the null hypothesis
and the alternative hypothesis.
This can be helpful to verify
that you are seeing the correct test.
For 'equal to' tests, this is not a big issue.
But for the 'less than' or 'greater than' tests,
this is important that you have
the correct order of the test.
Let's look at the analyses that can be performed.
If you have answered the question,
'Do you know the population variances?' as 'Yes',
then the appropriate test is right below.
It's the z-test two sample for means.
If we do not know the population variances,
then we move down to the test for two sample variances.
This is the F-test.
Remember from our previous session, I said,
before we could compare the means,
we must know whether or not the variances are equal.
I should mention to you that my Excel model
is a little bit more capable in doing
this test of variance than what you can do
by using tables in the back of the book.
This is because most tables for the F distribution
are only available at the 5% and 1% levels
of significance for a one-tailed test.
But if we did want to do an 'equal to' test
of variance test, meaning a two-tail test,
that we would be restricted to the 10% and 2% levels
of significance.
What this means is that the person using these tables
has to remember that there is this subtle issue,
and this can be a source of errors
when you use these tables for your test of variances.
My Excel model avoids this confusion
by giving you a switch for either 'equal to' tests
which are two-tail, or 'less than or equal to'
or 'greater than or equal to' tests
which are one-tailed tests.
And you can use any level of significance
that you would like.
To the right, my table for the critical values
of the F distribution will adjust automatically.
By using Excel, we have an infinite number
of tables available to us if we wanted
to use a table approach.
But I prefer to use Excel to just simply do
the direct calculations.
In practice, the 'equal to' test is the more common test.
You're testing to see that two variances are equal.
I have provided you a graphic to the right of this test
that graphically shows the results of this F-test.
Quite honestly, I have never seen any author
or instructor present a graphic for this F-test.
Based on the results of this test, we are guided
to either six A or six B.
In six A, we are doing the t-test
assuming equal variances.
And in six B, we are doing the t-test
assuming unequal variances.
This last test is for the special case
of paired samples or dependent samples.
For all of these tests, you do have to enter
a level of significance.
The results are then calculated for you.
The p-value is what we are going to pay attention to.
Remember that when the calculated p-value
is less than the level of significance,
we reject the null hypothesis.
Well, we have a little bit more complex model here,
but I think you will understand its use
after I show you how to use it to solve some problems.
Let's give it a try.
Customers at the FoodTown Supermarket have a choice
when paying for their groceries.
They can check out and pay
using a standard cashier-assisted checkout,
or they may use the new Fast Lane procedure.
In the standard procedure, a FoodTown employee
scans each item, puts it on a short conveyor
where another employee puts it in a bag,
and then into a grocery cart.
In the Fast Lane procedure, the customer scans each item,
bags it, and places it in the cart themselves.
The store manager would like to know
if the mean checkout time using the standard
checkout method is longer than using the Fast Lane method.
Stating the null hypothesis is always
a little bit tricky.
Since the manager wants to know if the standard
checkout time is longer than the Fast Lane time,
that's what the manager wants us to investigate.
Therefore, the null hypothesis
from the manager's perspective is that the checkout time
for the standard checkout system is less
than that of the Fast Lane system.
This is a one-tailed test.
Since we are not provided the raw data,
we put this data into the model
in the summary statistics area.
Then we go to step one.
Are we using raw data?
The answer to this is 'No'.
We have summary data.
Do we know the population variances?
Yes, we do, so we put a Y into this cell.
We enter L as the null hypothesis,
and since we entered a yes to question two,
we proceed to step four.
In the problem, we are told to use
the 1% level of significance.
It's a one-tailed test, and the result is
that we reject the null hypothesis.
What this means is that the data
that we collected suggests that the standard checkout time
is longer than the Fast Lane time.
If you compare our approach to that of the author's,
our approach is much faster.
Additionally, we get to compare our p-value
to the level of significance and see
that the p-value is much smaller
than the level of significance.
We can confidently reject the null hypothesis.
We can look at the graph showing the comparison
of these two data sets.
Certainly, they are not the same.
In fact, this would be a surprising result
if they both exactly overlapped each other.
To me, these two curves actually look
pretty close to each other, and one might be surprised
that we reject the null.
I think that in this case, we reject the null
because of the large sample size:
50 for one and 100 for the other sample.
With larger data sets, smaller graphical differences
in these two samples become more significant.
Let's do another problem.
Owens Lawn Care manufactures and assembles
lawnmowers that are shipped to dealers
throughout the United States and Canada.
Two different procedures have been proposed
for mounting the engine on the frame of the lawnmower.
The question is:
Is there a difference in the mean time
to mount the engines on the frames of lawnmowers?
The result of a time study is provided in a table.
Use the 10% level of significance.
Again, the challenge is to figure out
what is the null hypothesis.
The Vice President of Engineering's position is,
"Ah, they're the same.
"There's no difference."
It is up to us and the sample to prove
beyond reasonable doubt that there is a difference.
In this problem, we do have raw data
that we enter into our left side of our model.
Let's go to step one.
We do have raw data.
Do we know the population variances?
In this case, the answer is 'No',
that we do not know the population variances.
We will have to use the variances from the sample.
Our null hypothesis is an 'equal to' test.
And since we do not know the population variances,
we cannot use the first test.
We go to step five.
Following our model, we need to test
the sample variances to see whether or not they are equal.
In the textbook approach to this problem,
testing the variances is not done
because this particular textbook
does not teach testing of variances
until a later chapter, but we can do it ourselves.
Let's use the 5% level of significance.
Putting this into the model says
that the variances are the same.
Since the variances are the same,
we proceed to step six A.
The level of significance is 0.1,
and we do have a two-tailed test.
Our result is that we do not reject the null.
In other words, we have to conclude
that the means are equal.
The textbook solution to this problem
concludes the same thing, that we do not reject the null.
But if you look at the textbook solution,
you might notice that it is a lot more difficult
than our approach.
If we look at the graph showing the two sets of data,
we do see that they are different,
but this difference is not significant.
Thinking about how this chart compared
with our previous problem, you might wonder why
in this problem, do we not reject the null
like we did in the previous problem?
The difference is that in this problem,
we don't have a lot of data to base our decision on.
The sample size of the first set is five,
and the sample size of the second set is six.
So with smaller sample sizes,
even though the two graphs look like
they might be different, we cannot confidently say
that they are different
because we don't have enough data.
I really like this Excel model.
Let's do another problem.
Personnel in a consumer testing laboratory
are evaluating absorbency of paper towels.
They wish to compare a set of store brand towels
to a similar group of name brand ones.
For each brand, they dip a ply of the paper
into a tub of fluid, allow the paper to drain back
into the vat for two minutes, and then evaluate
the amount of liquid the paper has taken up from the vat.
A random sample of nine store brand paper towels
absorbed the following amounts of liquid in milliliters.
And then we're provided the data in this problem.
An independent random sample of 12 name brand towels
absorbed the following amounts,
and then we're provided the data.
Use the 10% significance level and test
if there is a difference in the mean amount of liquid
absorbed by the two types of paper towels.
This problem is similar to our previous problem.
We are provided the raw data.
I enter this into our Excel model
and then proceed to step one.
Are we using raw data? Yes.
Do we know the population variances? No.
The null hypothesis is an 'equal to' test.
Since we do not know the population variances,
we go to step five.
Are the two sample variances equal?
Well, we pretty much have this test set up
like we did in our last problem,
and we see that we reject the null,
that the variances are not equal.
What this then tells us to do
that we have to use test six B,
the variances are not equal.
The level of significance is 10%
and it is a two-tailed test.
The result is that we reject the null.
The means are not equal.
If we look at the results provided in the solution,
you should notice the use of Minitab
which is a specialized statistics software product.
And Minitab behind the scenes compared
the variances of the two samples
and found them not to be equal.
It then knew to use the test of means
for unequal variances.
If you look at our results and the results of Minitab,
you will see that they are identical.
You might notice once again that we don't have
to do all of these intermediate calculations.
We get to focus our attention on interpreting
the problem using the Excel model
to derive the results and interpreting the results.
If we look at the graph of these two sets of data,
we might notice that the means
and the variances do not appear to be the same.
Let's do another problem.
Lammers Limos offers limousine service
from the city hall in Toledo, Ohio,
to Metro Airport in Detroit.
Sean Lammers, president of the company,
is considering two routes.
One route is U.S. 25, and the other route is I-75.
He wants to study the time it takes
to drive to the airport using each route
and then compare the results.
He collects the following sample data
which is reported in minutes.
Using the 10% level of significance,
is there a difference in the variation
in driving times for the two routes?
Well, now this is a very realistic business problem.
If you're running a transportation company,
you want to know whether or not
you're taking the shortest route
to get to the destination.
The route that takes more time can be more costly.
So this is a very important question to answer.
We're given raw data, and we will enter this
into our model.
Are we using raw data? Yes.
Do we know the population variances? No.
This is exactly what we're calculating in this problem.
The null hypothesis is an 'equal to' test.
These conditions take us down to step five.
Are the two sample variances equal?
We put in a 10% level of significance,
and we conclude that we reject the null.
The variances are not equal.
And this, you will notice is exactly what
the author concludes.
But we can take this a step further.
Are the means the same?
We have to go to step six B.
If the variances are not equal, are the means equal?
Let's use a 10% level of significance
and a two-tailed test.
We conclude that we do not reject the null.
The means are equal.
Well, what do we really conclude
with both of these tests?
We cannot say beyond a reasonable doubt
that the means are different.
They are equal.
But the variations in driving times are different.
That's what we conclude.
I think that if you look at the chart
showing these two samples, you will see
that the means are nearly equal
but the variances are not.
I really like this technique of being able
to look at the graphic results
and compare it to what we get numerically, interesting.
You might notice that right below this test
that we just did is the test
for the special case for paired samples.
And you might even be wondering if any
of these problems should have used
this test for paired samples.
We do see the conclusion from this test
saying that this test is not applicable.
We have mismatch sample sizes,
and actually in all of the problems that we did,
we did not have the same sample sizes.
So we correctly did not use this paired sample test.
However, this problem about Lammer's Limos
could have been constructed as a paired sample test.
If we had taken, oh let's say, 12 drivers
and had the same 12 drivers drive both routes,
this would have been a paired sample test.
But this was not the case.
We had different drivers driving these two routes.
With different drivers, the samples are independent.
Now let's look at a problem that is a paired sample test.
Here we go.
Nickel Savings and Loan wishes to compare
the two companies it uses to appraise
the value of residential homes.
Nickel Savings selected a sample
of 10 residential properties and scheduled
both firms for an appraisal.
The results are reported in this table below.
At the 5% significance level,
can we conclude that there is a difference
between the firms' mean appraised home values?
This is a paired sample test
because both of these companies
are using the exact same 10 homes as their sample.
Okay, I enter this data into my Excel model.
Then I move to the area where I answer the questions.
Are we using raw data? Yes.
Do we know the population variances? No.
What kind of null hypothesis is this?
Nickel Savings and Loan thinks
that both companies provide the same appraisals.
We are wondering if the data suggests
that they are different.
So the null hypothesis is that they are equal.
We scroll down to this paired sample test.
We make sure to enter our level of significance at 5%,
and we see the conclusion that we reject the null.
If you look at how one solves this problem by hand,
there are these intermediate calculations
that need to be performed and reading of tables
in the back of the book.
This looks pretty involved, and it is,
and it does take some time to do this.
Our Excel model does all the calculations for us,
and we get to sit back and interpret the results.
Well, what is our interpretation?
Since we reject the null and the null was
that these two appraisal companies provide
the same appraisal, our conclusion from the data
is that they do not.
This could lead us to further exploration.
Our decision to reject the null
is exactly the same as the textbook conclusion.
Well, I hope by doing these problems,
you have gained a better appreciation
of how to perform these two sample tests.
Make sure to try doing these problems
and some others on your own.
Thanks for time to spend some moments with me.
I hope you have enjoyed what I have shared with you.
If you ever have any questions or need my help,
please let me know.