0% found this document useful (0 votes)
25 views16 pages

Copy of Lab Module 7

Uploaded by

Sarah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views16 pages

Copy of Lab Module 7

Uploaded by

Sarah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Chapter 12 Lab: Two Sample

In this lab you will be using a number of different excel functions to conduct statistical tests using t-statistics. Within excel ther
any task. Some are quicker than others, but others offer you more control. Follow the directions and use the formulas as direc
complete the lab quiz on canvas I will ask you for results from intermediate steps so you cannot skip those by using easier form
check your work if you are uncertain and trust that you can use those more accurately.

Formulae that may come in handy:


T.DIST(x,df,cumulative) If cumulative is TRUE, returns probability of a number being drawn from a t dis
freedom (df) to the left of the specified t-score (x)
T.DIST.RT(x,df) the added ".RT" stands for right tail. Same as above, but returns the probabilit
longer have to specify if it is cumulative
T.DIST.2T(x,df) The added ".2T" Stands for two tailed. Similar to the previous two, but this retu
negative. E.g. =T.DIST.2T(1.5,10) would return the sum of T.Dist(-1.5,10,TRUE)
values for positive and negative 1.5 in a t-test with 10 degrees of freedom.

T.INV(probability,df) Returns the t-statistic that has the specified probability to the left of it in a t-dis
you are doing a left tailed test you can use your alpha directly, for a right tailed
T.INV.2T(probability,df) Returns the t-statistic that has half of the probability above it, so that the nega
probability below it. You don't need to calculate your ±1-α/2 with this formula
MIN(T.DIST(x,n-1,TRUE),T.DIST(-x,n-1,TRUE)) The T.DIST() function tells you the probability to the left of the x value, howeve
Or a value further into the tail. If your x value is in the left tail then the p value is t
MIN(T.DIST(x,n-1,TRUE),1-T.DIST(x,n-1,TRUE)) exactly what the T.DIST() function tells you. On the other hand, if your x value i
incorrect. There are two ways you can handle this: since the t distribution is sym
above zero, and -x is the same distance from the mean in the left tail. If you tak
the probability to the right of x, if x is in the right tail. If x was already negative,
would now be wrong as -x would be in the right tail. thus, taking the minimum
the correct value. (think about why we know that the lower of the two values w
The other way to achieve this is by taking the minimum of T.Dist() and 1-T.DIST
above, but doesn't rely on symmetry, just principles of probability.
Sample t-tests
atistics. Within excel there are often multiple ways to complete
use the formulas as directed in each question. When you
hose by using easier formulas. You can use those formulas to

being drawn from a t distribution with the specified degrees of

ut returns the probability of a value to the right. Note you no

revious two, but this returns the p value for the t-statistic and its
m of T.Dist(-1.5,10,TRUE) and T.DIST.RT(1.5,10) as those are the p
degrees of freedom.

y to the left of it in a t-distribution with df degres of freedom. If


directly, for a right tailed test use 1-α. For two tailed, see below.
bove it, so that the negative of that t-statistic also has half of your
±1-α/2 with this formula, it will do it for you.
ft of the x value, however, the p value is the probability of getting
tail then the p value is the probability to the left of your x value,
her hand, if your x value is in the right tail this value is going to be
ce the t distribution is symmetrical if x is in the right tail, it is
n in the left tail. If you take the value to the left of -x it is equal to
f x was already negative, however the probability to the left of-x
hus, taking the minimum of the two options will always give you
lower of the two values will always be our p value)
m of T.Dist() and 1-T.DIST() which will produce the same effect as
probability.
Question 1
Following in the footsteps of William Gossett, you have now become the head experimental brewer in a local Salt Lake City br
a variation of a recipe you're developing by using a new variety of malt that supposedly will give it more flavor. Because Utah
to make sure that the new malt doesn't increase the alchohol content of your beer, otherwise it cannot be sold in grocery stor
content in ABV (alchohol by volume), and you can estimate ABV by comparing the density of the fluid before and after fermen
current recipe and the new recipe have the same stating specific gravity (the measure of density used in brewing)
Because it is expensive to brew experimental batches, your boss will allow you to brew five small batches of each before yo
whether or not to change malts. You measure the specific gravity of all ten total batches and mark them down. The mean of y
one, and denote it with a subscript 1) is 1.016 with a standard deviation of 0.06. The mean of the second recipe is 1.018 with a
Because a lot of money is on the line, you need to be very sure, so use a significance level of 1%. Can you change malts or will
ABV of your recipe?

Note: because of the way brewing works, a lower ending specific gravity indicates a higher ABV, so if you specifically want a
specific gravity. (longer explanation below)

n1= 5 1) Write out your null and alternative hypotheses, be sure to consider if this is a one or two ta
x̅1= 1.016
s1= 0.06 H0: µ1=µ2
n2= 10 H1: µ1≠µ2
x̅2= 1.018
0.08
s2=
α= 1%
2) Using the formula for a t-statistic we used in class, and excel as a calculator, test the null hy
the mean of the second recipe's standard gravity different in the desired way ? You can use T
use any other excel functions.

Differen denomenator
ce of of left hand
means side
tdata=
pdata=

3) Using
the data
provided
about the

x̅2= 1.018 [ Lower bound ,


s2= 0.08 CI= [ ,
n2= 10
ter
will
float
high
er
up, SE2=
and talpha=
the
dens
ity of
the
new
fluid
can
be
mea
sure
d
relat
ive
to
the
kno
wn
liqui
d’s
dens
ity.
This
mea
sure
of
dens
ity
relat
ive
to
wate
r’s
dens
ity is
calle
d
speci
fic
gravi
ty,
and
it
has
no
unit.
As
the
beer
ferm
ents,
suga
rs
are
conv
erte
d to
alco
hol
and
1
brewer in a local Salt Lake City brewery. You have decided to try
give it more flavor. Because Utah is your largest market, you have
se it cannot be sold in grocery stores. You measure alchohol
the fluid before and after fermentation. In this case both your
nsity used in brewing)
e small batches of each before you have to come to a decision
mark them down. The mean of your current recipe (call it recipe
f the second recipe is 1.018 with a standard deviation of 0.08.
1%. Can you change malts or will the second malt increase the

ABV, so if you specifically want a lower ABV, you need a higher

o consider if this is a one or two tail test. Use hypotheses so that y


Symbols you may need
x̅1 1.016
x̅2 1.018
≠ 13
± 2.65

xcel as a calculator, test the null hypothesis at an alpha of 0.01, Is


n the desired way ? You can use T.DIST() and T.INV(), but do not

denomenator
of right hand full
side denomenator

Upper bound ]
]
Questio
You have recently been practicing one of your favorite summertime games to play with your friends at a social gathering. The
hole in it. Landing a beanbag on the board earns you one point, and getting it in the hole gets your three. You typically are not
loves to boast and tell you things like "No one tosses a bean bag like Gaston" all the time, but unfortunately it is true and he is
You would like to take Gaston down a peg and beat him so you have been practicing. over the last two weeks you have thro
and recorded them below.
Note that your sample is made up of the means of each days throws, so each observation will be a mean distance, not the d

Mean 1) You want to know if the mean distance of your bean bag tosses is going to be less than 30
Day distance
1 2.2
2 29.4 n= 14
3 39.2 x̅= 28.84 Calculate the one sample t-statistic using the formu
t.dist() function to calculate its p-value
4 11.8 s=
5 45.6 SE= 5.2598
6 11.2 α= tdata= 1.77
7 39.2
8 41.8
9 17.8 The odds of an event occurring are defined in proba
Based on what you calculated above, what would y
10 29.6 Using either odds or probability, do you think challe
11 42.2
12 47.1 Odds
13 39.2
14 7.5 Do you feel confident based on the probability or th

t-Test: Paired Two Sample for Means

Mean distance Day

Mean 28.84286 7.5


Variance 244.0119 17.5
Observatio 14 14
Pearson Cor0.237196
Hypothesiz 0
df 13
t Stat 5.259808
P(T<=t) one7.711E-05
t Critical on 1.770933
P(T<=t) two 0.000154
t Critical tw 2.160369
Question 2
friends at a social gathering. The game is called Cornhole or bean bag toss, and the goal is to throw a small beanbag onto an inclined board
your three. You typically are not competitive, but your friend has recently started bringing their coworker, Gaston, to more gatherings. Ga
unfortunately it is true and he is quite good at Cornhole.
the last two weeks you have thrown 16 bags per day and recorded the distance from the hole each time. you averaged those distances ea

will be a mean distance, not the distance of an individual throw.

tosses is going to be less than 30 inches. Use a one-sample t-test to see if your mean distance is significantly less than 30 inches.

sample t-statistic using the formula from the lectures, excel doesn't have a formula for this so you have to do it by hand. Then use the corr
calculate its p-value

pdata= 7.71

ent occurring are defined in probability theory as the probability of an event happening divided by the probability that it won't happen, or
u calculated above, what would you say the odds of you getting within 30 inches of the hole are?
or probability, do you think challenging gaston is going to work out for you?

ent based on the probability or the odds that you will be able to beat Gaston?
l beanbag onto an inclined board with a
r, Gaston, to more gatherings. Gaston

you averaged those distances each day

ly less than 30 inches.

do it by hand. Then use the correct

bability that it won't happen, or p/(1-p).


Question 3
One of your favorite things in the world is giving cats belly scratches. You love it so much that you volunteer regularly at an an
developed a theory that gently humming the song Mr. Mistoffelees from the smash hit musical Cats to a cat will allow you to s
magical, mystical ability to make cats more willing to accept belly scratches.
You attempt to scratch the tummy of each of the 40 cats once, then the next day you try again while humming the song. you r
table below.

first try (pre- Second try Squared


Cat test) (post-test) Difference Difference
Milo 0 104 -30 900 1) Write out your null and alternative hyp
Simba 38 65 -27 729
Fyodor 45 66 -21 441 H0:
Callie 2 15 -13 169 H1:
Gatsby 88 102 -14 196
Focaccia 80 52 28 784 2) Calculate the sum of D and the sum of D
Loki 47 58 -11 221
Bilbo 22 19 3 9 3) Calculate the paired sample t-statistic a
Nicolae Meowșescu 14 21 -7 49
Hemingway 84 96 -12 144
Gatsby 1 0 1 1 tdata= -1.824
Clam Chowder 7 0 7 49 pdata= 0.03789
Haiku 10 31 -21 441
Simba 84 99 -15 225
Dracula 17 44 -27 729 4) Now calculate this statistic: the mean o
relationship between this and the one you
Jasper 61 87 -26 676 standard error)
Charlie 19 30 -11 221
Ham Sandwich 62 78 -16 256
Captain Ahab 55 47 8 64 Mean : 33.918187
Funnel Cake 11 6 5 25 StDev.p: 7.9804448
Capote 19 25 -6 36 n: 40
Baked Beans 73 66 7 49 SE: 17.004935
Dracula 50 56 -6 36
Hemingway 23 47 -24 576
Focaccia 89 62 27 729 4) Now, use the data analysis toolpak to c
for Means" then select your post-test and
Baklava 58 66 -8 64 (which seems intuitive) your t-statistic wil
Bacon Bits 52 41 11 121 against what you calculated. You can sele
Bilbo 42 52 -10 100
Name 62 78 -18 324
Kitty 40 19 21 441
Finnian 1 13 -12 144
Jack 5 8 -3 9
Church 79 88 -9 81 3
Loki 60 66 -6 36 t-Test: Paired Two Sample for Means
Kitty 80 68 12 144
Simba 6 0 6 36 Difference
Ernest 16 12 4 16 Mean -4.425
Simba 26 28 -2 4 Variance 232.96859
Chairman Meow 33 8 25 625 Observatio 40
Meaty 13 0 13 169 Pearson Cor-0.177255
SUM: -177 10069 Hypothesiz 0
df 39
31.5554175 t Stat -6.001312
P(T<=t) one-2.579E-07
t Critical on1.6848751
P(T<=t) two-5.157E-07
t Critical tw2.0226909
uestion 3
ou volunteer regularly at an animal shelter to help with the cats. Throughout the last few years you have
Cats to a cat will allow you to scratch their tummy for longer. You want to test if this song really does have the

while humming the song. you record the number of seconds you were able to scratch each cat's tummy on the

ut your null and alternative hypotheses

µ1=µ2

e the sum of D and the sum of D^2 in the columns to the left.

e the paired sample t-statistic as shown in the book or the lectures, then use =t.dist.rt() to calculate the p-value.

culate this statistic: the mean of D, divided by the standard error of D. Do you notice anything about the
p between this and the one you calculated above? (Use the population standard deviation when calculating the
rror)

mystery statistic:

Do you notice anything about the relationship between this and the one you calculated
above?

e the data analysis toolpak to calculate the t-statistic and p-value for this dataset. Use "t-test: Paired Two Sample
" then select your post-test and pre-test columns. If you put pre-test as variable 1 and post-test as variable two
ms intuitive) your t-statistic will be negative, but your p-values will still be correctly calculated. Check this result
at you calculated. You can select the output to be whatever you want, but the green cell below is a nice spot.
4
ed Two Sample for Means
t-Test: Paired Two Sample for Means
Squared Difference
251.725 first try (pre-test)
Second try (post-test)
71194.512 Mean 41.2 45.575
40 Variance 823.49744 1021.2763
Observatio 40 40
Pearson Cor0.8794838
Hypothesiz 0
df 39
t Stat -1.817889
P(T<=t) one-0.0383844
t Critical on1.6848751
P(T<=t) two-0.0767689
t Critical tw2.0226909
t-Test: Paired Two Sample for Means

first try (pre-test)


Second try (post-test)
Mean 39.35 45.575
Variance 835.92564 1021.2763
Observatio 40 40
Pearson Cor 0.752941
Hypothesiz 0
df 39
t Stat -1.824149
P(T<=t) one-0.0378992
t Critical on1.6848751
P(T<=t) two-0.0757985
t Critical tw2.0226909
Question
Below is an array of data from two samples. Using the T.TEST() function, calculate the following t-tests:
The T.TEST(array1, array2, tails, type) function Data
requires four pieces of information, the first two
variables will be arrays. Select the column with the x1= x2=
data for the first variable, or use the CELL:CELL 0.63 0.83
notation to indicate the data from the first variable.
Second, do the same again for the second variable. -1.4 -0.28
The third input is going to be either a 1 or a 2 to 0.54 -0.79
indicate the number of tails you want on your test. If -1.98 2.48
it is one tail, excel will pick either the left or the right
based on your two arrays. Finally you need to tell -1.17 0.8
excel what type of test you are running. there are -2.57 2.63
three options: 1 - Paired; 2 - unpaired, homoskedastic; 2.63 1.19
3 - unpaired heteroskedastic. For this example we are
going to select option 2, so put "2" in the final input in -1.15 -1.88
the formula. -0.97 1.13
1.27 -2.02
0.53 -0.15
-0.57 -0.9
-1.8 0.19
-2.62 1.39
1.16 0.55 t-Test: Two-Sample Assuming Equal Va
-2.08 0.21
1.35 -0.19 x1=
-1.98 0.28 Mean -0.4835
-1.36 1.33 Variance 2.533266
1.87 0.2 Observations 20
Pooled Varian 2.004191
Hypothesized 0
df 38
t Stat -1.861813
P(T<=t) one-ta 0.035188
t Critical one-t 1.685954
P(T<=t) two-ta 0.070377
t Critical two-t 2.024394
uestion 4
sts:

t-Test: Paired Two Sample for Means

x1= x2=
Mean -0.4835 0.35
Variance 2.533266 1.475116
Observations 20 20
Pearson Correlat -0.345704
Hypothesized Me 0
df 19
t Stat -1.612312
P(T<=t) one-tail 0.06169
t Critical one-tail 1.729133
P(T<=t) two-tail 0.123381
t Critical two-tail 2.093024

ample Assuming Equal Variances

x2=
0.35
1.4751157894737
20

You might also like