Choosing the correct analysis (and reading Minitab output)
(#1-2) One numerical variable
If you have one numerical variable:
- you have one population that you are trying to describe
- it would be natural to summarize the data using a mean. (Note that
you could also summarize the data using a median, but we've not learned how
to perform hypothesis tests and confidence intervals for a median.)
- so, use 1 sample t procedures. Perform the hypothesis test if you
want to test if the population mean equals something. Calculate the confidence
interval if you want to estimate the value of the population mean m.
Example
A random sample of 32 Stat 250 students were asked: What is your current
cumulative GPA? The data were entered into a column in Minitab. Two (2)
of the students declined to answer the question, and so are denoted as missing
("*"). The data are:
gpa
* 3.60 3.01 3.41 2.50 2.75 3.59 3.00 3.91 3.13
2.40 3.94 3.25 3.00 3.50 3.98 2.50 3.45 2.69 2.67
3.35 2.80 3.40 2.88 3.73 2.10 2.45 3.42 2.50 2.00
* 2.74
|
The Minitab output looks like:
T Confidence Intervals
Variable N Mean StDev SE Mean 95.0 % CI
gpa 30 3.0550 0.5444 0.0994 ( 2.8517, 3.2583)
T-Test of the Mean
Test of mu = 3.0000 vs mu > 3.0000
Variable N Mean StDev SE Mean T P
gpa 30 3.0550 0.5444 0.0994 0.55 0.29
|
The output tells us:
- that we asked Minitab to test the null hypothesis H0: m
= 3.0 against the alternative hypothesis HA: m
> 3.0.
- that N = 30 students responded
- the sample mean g.p.a ("Mean") is 3.055. That is, the average
g.p.a. of the 30 students in the sample is 3.055.
- the sample standard deviation ("StDev") is 0.5444. That is the
standard deviation of the g.p.a. of the 30 students is 0.5444
- the standard error of the mean ("SE Mean") is 0.0994. Recall that
the standard error of the mean is the sample standard deviation divided by
the square root of the sample size. So, here SE Mean is 0.5444/sqrt(30) =
0.0994.
- A 95% confidence interval for the population mean is 2.852 to 3.258. That
is, we can be 95% confident that the mean g.p.a. of all students in the conceptual
population of Stat 250 students is between 2.852 and 3.258. Recall that, if
n > 30, the 95% confidence interval will be close to the sample mean ±
(2 × standard errors). So, as you can see here, the 95% confidence interval
is approximately 3.055 ± (2 × 0.0994).
- The t-statistic ("T") for the requested hypothesis test is 0.55,
which translates into a P-value of 0.29. (That is, the area under the t curve
with N-1 = 29 degrees of freedom to the right of 0.55 is 0.29. That is, there
is a 29% chance that we'd get a sample mean as large as 3.055 if the population
mean is 3.00. The sample mean is not unlikely, so we don't reject the null
hypothesis.)
(#3-4) One categorical (binary) variable
If you have one categorical (binary) variable:
- you have one population that you are trying to describe
- it would be natural to summarize the data using a proportion (percentage)
- so, use 1 proportion Z procedures. Perform the hypothesis test if
you want to test if the population proportion equals something. Calculate
the confidence interval if you want to estimate the value of the population
proportion p.
Example
A random sample of 87 students were asked: Have you ever dyed your hair?
Yes or No. The data were entered into a column in Minitab -- the Yes and
No responses were coded as a 1 and 0, respectively. The data are:
dyed
0 0 0 1 1 1 1 0 1 0 0 1
0 1 1 0 1 0 0 0 1 0 1 0
1 0 0 1 0 0 1 1 0 0 1 1
1 1 1 0 0 1 1 1 1 1 1 0
0 1 0 0 0 1 0 1 1 1 1 0
0 0 1 0 0 0 1 0 1 1 0 0
0 1 1 0 0 0 0 0 0 0 0 0
0 0 0
|
The Minitab output looks like:
Test and Confidence Interval for One Proportion
Test of p = 0.5 Vs p < 0.5
Success = 1
Variable X N Sample p 95.0 % CI Z-Value P-Value
dyed 38 87 0.436782 (0.332560, 0.541004) -1.18 0.119
|
The output tells us:
- that we asked Minitab to test the null hypothesis H0: p = 0.5
against the alternative hypothesis HA: p < 0.5
- that N = 87 students were surveyed
- that X = 38 of the surveyed students said they had once dyed their hair
("Success = 1")
- the sample proportion ("Sample p") is 0.436782. That is, 38/87,
or 43.6782% of the surveyed students reported having dyed their hair once
- A 95% confidence interval for the population proportion is 0.333 to 0.541.
That is, we can be 95% confident that between 33.3% and 54.1% of the population
of all students have dyed their hair once.
- The Z-statistic ("Z-value") for the hypothesis test is -1.18,
which translates into a P-value of 0.119. (That is, the area under the normal
curve to the left of -1.18 is 0.119. That is, there is a 11.9% chance that
we'd get a sample proportion as small as 0.437 if the population proportion
is 0.50. The sample proportion is not unlikely, so we don't reject the null
hypothesis.)
(#5-6) One categorical (binary) variable that forms independent groups and
one numerical variable
If you have one categorical (binary) variable that forms independent groups
and one numerical variable:
- you have two populations that you are trying to compare. The populations
are formed by each level of the binary variable.
- If the binary variable forms independent groups, use these 2-sample (#5-6)
procedures. If the binary variable forms paired groups, use the paired (#7-8)
procedures instead. Hint on deciding: Ask yourself if the same (or similar)
person (or object) was measured twice. If so, then use the paired (#7-8) procedures.
If not, then use these 2-sample (#5-6) procedures.
- it would be natural to summarize the numerical variable data calculating
a mean for the first group and a mean for the second group
- so, use 2 sample t procedures. Perform the hypothesis test if you
want to test if the population means are the same (i.e. if the difference
in the population means is 0). (Note that testing to see if the population
means are the same is equivalent to testing whether or not there is a relationship
between the binary variable and the numerical variable.) Calculate the confidence
interval if you want to estimate the difference in the population means m1
- m2.
Note that here we are effectively treating the binary variable that forms the
groups as the explanatory variable and the numerical variable by which we're
comparing the groups as the response variable. If we switched the variables
around and treated the numerical variable as the explanatory variable and treated
the binary variable as the response variable, we'd need to do a "logistic
regression analysis," which is beyond the scope of this course.
Example
A random sample of 31 students were asked two questions:
- What is your gender? Male or Female.
- How much money did you spend on textbooks this semester?
The data were entered into two columns in Minitab. One column contains the
gender ("subscripts") of the student, while one column contains the
amount of money spent on books ("samples"). Males were coded as a
1 and females as a 2. The data are:
Row Sex Books
1 1 400
2 1 500
3 2 210
4 1 200
5 2 240
6 1 160
7 1 400
8 2 300
9 2 250
10 2 300
11 1 465
12 1 300
13 2 145
14 1 345
15 2 350
16 1 350
17 2 300
18 2 300
19 1 300
20 2 300
21 1 350
22 1 550
23 1 245
24 1 230
25 2 340
26 1 129
27 2 300
28 2 200
29 2 159
30 1 330
31 1 270
|
The Minitab output looks like:
Two Sample T-Test and Confidence Interval
Two sample T for Books
Sex N Mean StDev SE Mean
1 17 325 116 28
2 14 263.9 64.4 17
95% CI for mu (1) - mu (2): ( -7, 129)
T-Test mu (1) = mu (2) (Vs not =): T = 1.85 P = 0.076 DF = 25
|
The output tells us:
- that we asked Minitab to test the null hypothesis H0: m1
= m2 against the alternative hypothesis
HA: m1
m2
- that N = 17 males ("Sex = 1") and N = 14 females ("Sex =
2") responded
- that the sample mean for the males is $325 and the sample mean for the females
is $263.90.
- that the sample standard deviation for the males is $116, and the sample
standard deviation for the females is $64.40.
- that the standard error of the mean for the males is $28, and the standard
error of the mean for females is $17.
- A 95% confidence interval for the difference in the population means, m1
- m2, is -7 to 129. That is, we can
be 95% confident that the difference in the population means is between -$7
and $129. That is, the difference in the means could be anywhere from the
males spending $7 less to $129 more than the females. Because the confidence
interval contains 0, we can't conclude the mean amount spent by the males
differs than the mean amount spent by the females.
- The t-statistic ("T") for the hypothesis test is 1.85, which translates
into a P-value of 0.076. (That is, 2 × the area under the t curve with
25 degrees of freedom ("DF") to the right of 1.85 is 0.076. That
is, there is a 7.6% chance that we'd get a difference in the sample means
as large as $61.10 ($325 minus $263.90) if the difference in the population
means is 0. The difference in the sample means is not unlikely enough, so
we don't reject the null hypothesis.)
(#7-8) One categorical (binary) variable that forms paired groups and one
numerical variable
If you have one categorical (binary) variable that forms paired groups and
one numerical variable:
- you have two populations that you are trying to compare. The populations
are formed by each level of the binary variable.
- If the binary variable forms independent groups, use the 2-sample (#5-6)
procedures. If the binary variable forms paired groups, use these paired (#7-8)
procedures instead. Hint on deciding: Ask yourself if the same (or similar)
person (or object) was measured twice. If so, then use these paired (#7-8)
procedures. If not, then use the 2-sample (#5-6) procedures.
- it would be natural to summarize the numerical variable data calculating
the mean of the paired differences of the two groups.
- so, use paired procedures. Perform the hypothesis test if you want
to test if the mean of the paired differences is 0 (i.e. if the population
means are the same). Calculate the confidence interval if you want to estimate
the mean of the paired differences mD.
Example
The pulse rates of a random sample of 10 students were measured. Then, the
students were asked to march in place. Their pulse rates were measured again.
The data were entered into two columns in Minitab. One column contains the students'
pulse rates before marching, while one column contains the students' pulse rates
after marching. The data are:
Row Bef Aft
1 60 72
2 62 92
3 80 84
4 67 68
5 70 80
6 52 72
7 56 80
8 75 88
9 56 64
10 80 104
|
Note that we could calculate and enter the differences, and then use the 1-sample
t procedures on the column of differences. Instead, we can let Minitab do the
dirty work of calculating the differences by just using Mintab's paired t procedures.
The Minitab output looks like:
Paired T-Test and Confidence Interval
Paired T for Bef - Aft
N Mean StDev SE Mean
Bef 10 65.80 10.21 3.23
Aft 10 80.40 12.14 3.84
Difference 10 -14.60 9.51 3.01
95% CI for mean difference: (-21.40, -7.80)
T-Test of mean difference = 0 (vs < 0): T-Value = -4.85 P-Value = 0.000
|
The output tells us:
- that we asked Minitab to consider the Bef - Aft differences. That is, subtract
the after pulse rates from the before pulse rates.
- that N = 10 students were measured
- the sample mean of the differences, Bef - Aft, is -14.60 beats per minute.
- the sample standard deviation of the differences, Bef - Aft, is 9.51 beats
per minute.
- the standard error of the mean of the differences, Bef - Aft, is 3.01. Recall
that the standard error of the mean is the sample standard deviation divided
by the square root of the sample size. So, here SE Mean is 9.51/sqrt(10) =
3.01.
- A 95% confidence interval for the mean of the Bef-Aft differences, mD,
is -21.40 to -7.80. That is, we can be 95% confident that the mean of the
Bef-Aft differences is between -21.40 to -7.80 beats per minute. That is,
we can be 95% confident that the mean pulse rate before exercise is
between 21.4 and 7.8 beats lower than the mean pulse rate after
exercise.
- we asked Minitab to test the null hypothesis H0: mD
= 0 against the alternative hypothesis HA: mD<0.
That is, we want to test that the pulse rates have increased on average.
- The t-statistic ("T") for the hypothesis test is -4.85, which
translates into a P-value of 0.000 (to 3 decimal places). (That is, the area
under the t curve with N-1 = 9 degrees of freedom to the left of -4.85 is
0.000... That is, there is a very small chance (P < 0.001) that we'd get
a sample mean difference as large as -14.60 if the mean difference in the
population is 0. The sample mean difference is very unlikely, so we reject
the null hypothesis without hesitation.)
Note that if we had asked Minitab to consider the Aft-Bef differences, our
conclusions would not change. The output would look like:
Paired T-Test and Confidence Interval
Paired T for Aft - Bef
N Mean StDev SE Mean
Aft 10 80.40 12.14 3.84
Bef 10 65.80 10.21 3.23
Difference 10 14.60 9.51 3.01
95% CI for mean difference: (7.80, 21.40)
T-Test of mean difference = 0 (vs > 0): T-Value = 4.85 P-Value = 0.000
|
Note that:
- we'd have to change our alternative hypothesis to HA: mD
> 0, since we are still interested in testing that the pulse rates increased
on average. It's just now that a positive number suggests an increase.
- The sample mean difference (14.60) and the 95% confidence interval (7.80
to 21.40) just changed signs. The confidence interval tells us that we can
be 95% confident that the mean pulse rate after exercise is between
7.8 and 21.4 beats higher than the mean pulse rate before exercise.
- The P-value is still 0.000...., so we still reject the null hypothesis,
and conclude that the mean difference is greater than 0, which is consistent
with concluding that the mean pulse rate after exercise is greater than the
mean pulse rate before exercise.
(#9-11) One categorical (binary) variable that forms independent groups and
one categorical (binary) variable
Here, one categorical variable forms two or more independent groups. It would
be natural to summarize the second categorical variable by calculating a proportion
for the first group and a proportion for the second group and a
proportion for the third group and so on.
The chi-square test (#11) and the 2-proportions Z procedures (#9) are used
to see:
- if there is a relationship between the two categorical variables
- if the proportions for each group are equal
That is, the above two goals are equivalent.
How to decide what to use:
- If the categorical variable that defines the groups forms three or more
groups (you have "greater than" a 2 × 2 table), you must use
the chi-square test (#11) to compare the proportions. (In this case, you cannot
calculate a confidence interval for the three or more groups simultaneously.
You can only calculate a confidence interval for the difference in two of
the proportions at a time. If you do this, use the 2-proportions Z-interval.)
- If the categorical variable that defines the groups forms two groups
(i.e. you have a 2 × 2 table), you can either use the chi-square test
(#11) or the 2 proportions Z-test (#10) to compare the proportions. The two
different P-values that you get should be nearly the same. The advantage of
using the 2 proportions Z-test is that Minitab will also automatically calculate
and report a confidence interval for the difference in the proportions, too.
- If you want to estimate the difference in two population proportions, calculate
a 2-proportions Z-interval (#9).
Example
A random sample of 70 Stat 250 students were asked two questions:
- What is your gender? Male or female.
- Do you read your horoscope regularly? Yes or No.
The data were entered into two columns in Minitab. One column contains the
students' gender, while one column contains the students' answer to the horoscope
question. The males were coded as a 1, while the females were coded as a 2.
Yes responses were coded as a 1, while No responses were coded as a 0.
Because gender forms only two independent groups -- males and females -- we
can use either the chi-square test or the 2-proportions Z-test to see if there
is a relationship between gender and horoscope reading. We can specify what
we are testing either of the following ways.
Way #1
- H0: There is no relationship between gender and horoscope reading.
- HA: There is a relationship between gender and horoscope reading.
Way #2
- H0: The proportion of males who read their horoscope regularly
is the same as the proportion of females who do. That is, pM =
pF.
- HA: The proportion of males who read their horoscope regularly
is not the same as the proportion of females who do. That is, pM
pF.
The Minitab output for the chi-square test looks like:
Tabulated Statistics
Rows: gender Columns: horoscop
0 1 All
1 32 5 37
86.49 13.51 100.00
32 5 37
26.96 10.04 37.00
2 19 14 33
57.58 42.42 100.00
19 14 33
24.04 8.96 33.00
All 51 19 70
72.86 27.14 100.00
51 19 70
51.00 19.00 70.00
Chi-Square = 7.372, DF = 1, P-Value = 0.007
Cell Contents --
Count
% of Row
Count
Exp Freq
|
Note that Minitab tells us what each of the numbers in each of the cells means.
The first number in each cell is the number of the people in the sample having
the two characteristics defined by the cell. The second number in each cell
is the row percentage. In this case, in the (1,1) cell, it is the percentage
of males who read their horoscope regularly. The last number in each cell is
the number of people in the sample we'd expect to fall in the cell if the null
hypothesis were true, i.e. if there were no relationship between gender
and horoscope reading.
The output tells us:
- 5 out of 37, or 13.51% of the males read their horoscope regularly
- 14 out of 33, or 42.42% of the females read their horoscope regularly
- The chi-square statistic, which quantifies how much the observed and expected
counts differ, is 7.372. The P-value of 0.007 tells us it is unlikely that
we'd get such a large chi-square statistic if there were no relationship between
gender and horoscope reading. We can reject the null hypothesis and conclude
that the proportions of males and females who read their horoscope differ.
The corresponding Minitab output for the 2-proportions Z-test and interval
is:
Test and Confidence Interval for Two Proportions
Success = 1
gender X N Sample p
1 5 37 0.135135
2 14 33 0.424242
Estimate for p(1) - p(2): -0.289107
95% CI for p(1) - p(2): (-0.490522, -0.0876921)
Test for p(1) - p(2) = 0 (vs not = 0): Z = -2.81 P-Value = 0.005
|
The output tells us:
- There are N = 37 males in the sample and N = 33 females in the sample.
- Minitab is counting the number of people who read their horoscope regulary
("Success = 1"). So, 5 of the males in the sample read their horoscope
regularly and 14 of the females read their horoscope regularly.
- 13.5% (from 5/37) of the males in the sample read their horoscope regularly
and 42.4% (from 14/33) of the females read their horoscope regularly. Note
that the sample percentages are the same as calculated in the above chi-square
test output.
- The difference in the sample proportions (males (1) - females (2)) is -0.289
(from 0.135 - 0.424).
- We asked Minitab to test the null hypothesis H0: p1
= p2 against the alternative hypothesis HA: p1
p2.
- The Z-statistic ("Z") for the hypothesis test is -2.81, which
translates into a P-value of 0.005. (That is, 2 × the area under the
normal curve to the left of -2.81 is 0.005.) Note that the P-value is very
close to the P-value we got from the chi-square test (P = 0.007).
- We can be 95% confident that the difference in the population proportions
is between -0.491 and -0.088. That is, we can be confident that between 8.8%
and 49.1% more females read their horoscope regularly than males.
Two numerical variables
- Use a scatter plot to identify outliers and to view the potential relationship
between the two variables.
- Calculate a least squares regression line to estimate the linear relationship
between the two variables.
- Use the least squares regression line to predict future values of the response
variable.