You are on page 1of 4

Chapter 12

How can we tell if a difference we observe in the sample means (x indicates a real difference in the underlying proportion means (?
Well need to know the sampling distribution model and standard deviation of the difference. Once we know those, we can build a confidence interval and test a
hypothesis just as we did for a single mean. As long as the two groups are independent, we find the standard deviations of the two groups of the difference between the
two sample means by adding their variance and then taking a square root x 1 - x 2)=(

) (

)
*if the sample means comes from independent samples,
the variance of their sum or difference is the sum of their variances.
We usually dont know the true standard deviations of the two groups 1 and 2, so we substitute the estimates, s1 and s2, and find the standard error:
2
2
2
1
2
1
n
s
n
s
SE + =

We use (x 1, s1) and (x 2, s2) to estimate 1,1) and 2,2 because the two independent simple random samples from two distinct populations 1,1) and 2,2) are both
unknown. To compare the means both populations should be normally distributed. But it is enough that the two distributions have similar shapes and that the sample
data contain no strong outliers. Just as we did for one mean, well use the standard error to see how big the difference really is. The ratio of the difference in the means
to the standard error of that difference has a sampling model that follows the t-distribution, with which we use the standard error. We just need the degrees of freedom
for the t-model. The degrees of freedom formula of the sampling distribution of the difference between two means is always at least the smaller of either n1-1 or n2-1.
If the conditions are met then you should use a t-model. And the method will be a two sample t-test.
The two-sample t-test: Sometimes we are given a set of numbers and we have to figure out the mean and standard deviation and other times we are given the mean and
standard deviation. To find the observed difference in the two means: x 1- x 2. To figure out the standard deviation:
( )

Then we start by hypothesizing a value for


the true difference of the means. The null hypothesis is that both population means 1 and 2 are equal, thus their difference is equal to zero.
H0: 1 = 2 <=> 1 2 = 0
with either a one-sided {(Ha: 1 2 <=> (1 2) < or > 0} or two-sided {(Ha: 1 2 <=> (1 2 0} alternative hypothesis. We then use the critical value of the t-
statistic, calculated from the t-model:
2
2
2
1
2
1
2 1
n
s
n
s
x x
t
+

=
, and get the t-ratio (observed t-value). We find how many standard errors (SE) away from (1 2) is (x 1- x 2) by
standardizing with t and using a number of degrees of freedom given by a special formula: the smallest of either n1-1 or n2-1.

**We use that model to compare our t-ratio with a critical value for t to determine whether to reject or fail to reject the null hypothesis. If there is a significant
difference we reject the null hypothesis. We reject null hypothesis if t-ratio (observed t-value) > critical value of t (found with the T-table using the degrees of
freedom and X% significance level). We fail to reject null hypothesis if t-ratio (observed t-value) < critical value (found with the T-table using the degrees of
freedom and X% significance level).
**To obtain the P-value mathematically, you look in the T-table using the t-ratio (observed t-value) and degrees of freedom. This gives you a rough estimate of
the P-value. But to obtain a more precise P-value, you look in the Z-table using your t-ratio (observed t-value) and whatever value you find you subtract that
from 1. For example with a t-ratio of 3.22 and df 1000, you get a P-value of 0.0006 using the Z-table and using a T-table you can only figure out that the P-
value is less than 0.005. If the P-value is small we reject the null hypothesis and if the P-value is high then we fail to reject the null hypothesis.

Confidence Intervals: A hypothesis test really says nothing about the size of the difference. All it says is that the observed difference is large enough that we can be
confident it isnt zero. Thats what the term significantly different means. It doesnt say that the difference is important, financially significant, or interesting.
Rejecting the null hypothesis simply says that the observed statistic is unlikely to have been observed if the null hypothesis were true. So we use confidence intervals to
determine business decisions. For example, whether the company should offer a promotion or not or whether they should introduce a new product or upgrade
equipment. If we reject the null hypothesis then we use the confidence interval for decisions.
-C is the area between - t
*
and + t
*

-We find t
*
from the T-table by using the degrees of freedom formula and the confidence level C (is given).
-When the condition are met of a rejecting null hypothesis, we can find a two-sample t-interval for the difference between the means of two independent groups. The
confidence interval is: (

, where
m x x ) (
2 1
;
2
2
2
1
2
1
*
n
s
n
s
t m + =

There are two versions of the two sample test: one assuming equal variance (pooled) and one not assuming equal variance (unequal) for the two populations. They have
slightly different formula and degrees of freesom.
When both populations have the same standard deviation, the pooled estimator of SD
2
is:
The sampling distribution for (x1 x2) has exactly the t distribution with (n1 + n2 2) degrees of freedom.
To test the hypothesis H0: 1 = 2 against a one-sided or a two-sided alternative, compute the pooled two-sample t statistic for the t(n1 + n2 2) distribution.
. CI =
The paired t-test-
Paired Differences
The confidence interval for d is
1 n
) d (d
s
n
1 i
2
i
d

=

=
n
s
t d
d

Where t has n - 1 d.f. and s


d
is:
(continued)
n is the number of pairs in the paired sample


The test statistic for d is
1 n
) d (d
s
n
1 i
2
i
d

=

=
n
s
d
t
d
d

=
Where t has n - 1 d.f.
and s
d
is:
n is the
number
of pairs
in the
paired
sample
Hypothesis Testing for
Paired Samples

Chapter 13
When we have proportions categorical data you cant expect them to match exactly in two separate tables. There is going to be variability. Are these deviations
significant enough for us to assume a recognizable pattern? To address this question, we test the tables goodness-of-fit, where fit refers to the null model proposed. A
goodness-of-fit is an inferential procedure used to determine whether a frequency distribution follows a claimed distribution. Data for this test are organized in tables
and the assumptions and conditions reflect that. In a goodness-to-fit test for a probability model, the null hypothesis states that the model is correct. That is, H0: p1 = 1,
p2 = 2,.., pr = r , where 1, 2,.., r are the category probabilities according to the model. The alternative hypothesis is, HA: HO is not correct. HO specifies that all
categories are equally likely.
The Chi-Square Model:
The test statistic, called the chi-square statistic is:
()


Characteristics
-the larger the value of chi-square statistic is the more evidence that we have against the null hypothesis to reject it. A smaller chi-square means that our model fits the
data well so we have no reason to doubt the null hypothesis.
-If Ho is correct then a chi-square statistic follows a distribution with r-1 degrees of freedom, where r is the number of categories.
-We use the chi-square only for testing hypotheses, not for constructing confidence intervals.
-If the observed counts dont match the expected counts, the statistic will be large.
-the chi-square statistic is always one-sided.
-Unlike normal and t families, chi-square models are skewed. As the number of degrees of freedom increases, the chi-square distribution becomes more symmetric.
-the values are non-negative
-The expected value(mean) of a chi-square model is its number of degrees of freedom.
-Large chi-square values mean lots of deviation from the hypothesized model, so they give small P-values. Refer to chapter 12 on how to understand and obtain P-
values
**Combining categories- the can be unreliable if some of the categories have expected counts less than 5. So, categories with small expected counts should be
combined to overcome this problem.
Chi-Square Calculation Steps:
1) Find the expected values- these come from the null hypothesis model:



2) Compute the residuals: When we reject a null hypothesis in a goodness-of-fit test, we can examine the residuals in each cell to learn more. Because we want to compare
residuals for cells that may have very different counts, we standardize the residuals. We know the mean residual is 0, but we need to know each residuals standard
deviation. So once you have expected values for each cell, we standardize the residuals:
()


3) Compute the components: Find
()

for each cell.


4) Find the sum of the components:
()


5) Find the degrees of freedom: its equal to the number of cells minus 1 (r-1).
6) Test the Hypothesis: figure out whether to reject or fail to reject the null hypothesis from the P-value (refer to chapter 12 for understanding of P-values)

Chi Square test for Homgeneity and Independence- both test are pretty much identical. In the case of independence, we have a single sample from a single
population. For each individual in this SRS of size n we measure two categorical variables. The results are summarized in a two way table. For homogeneity, we test to
see whether the distribution is the same for all groups. The Ho is that the distribution are the same for all groups. If the distributions are homogenous then the
proportions should be the same. When using homogeneity, we examined one of the variables as different groups, rather than as levels of a variable. For example, a
question is asked and the responses were scaled from 1 to 7 and the responses were broken down by country origin of the person answering. However, in a test of
independence we use age as the second variable in a contingency table instead of country origin. The difference between the two tests is in how we think of the data.
*Remember that for any two events to be independent, A and B, the probability of event A given that event B occurred must be equal to the probability of event A. For
independence test we have two categorical variables measured on a single population (this is how we determine whether it is a homogenous or independent. For
homogeneity test, we had a single categorical variable measured independently on two or more populations (different country origins is multiple populations).
*When computing the chi-square statistic for independent and homogeneity tests use (r-1)x(c-1) for degrees of freedom to determine where it falls on the chi-square
table to figure out the P-value and whether to reject or fail to reject Ho. r is the rows and c is the columns. (P-value= PX )

Confidence Intervals for the Difference of Two Proportions:
Even though the z-test and chi-square test are equivalent for testing whether two proportions are the same, the z-test can also give a confidence interval. This is an
important advantage
We often need to compare two treatments used on independent samples. We can compute the difference between the two sample proportions and compare it to the
corresponding approximately normal sampling distribution for (p
1- p
2). There is an equivalent way of testing the equality of two proportions that uses a z-statistic. So
for two independent SRSs of sizes n1 and n2 with sample proportion of successes p
1 and p
2, an approximate level C confidence interval for p1-p2 is:
Confidence Interval =
error of margin the is , ) (
2 1
m m p p
;
SE z m * =
; SE=
2
2 2
1
1 1
) 1 ( ) 1 (
n
p p
n
p p
+


*If the null hypothesis is true (Ho: p1 = p2), then we can only rely on the properties of the sampling distribution to estimate the probability of drawing two samples with
proportions p
1 and p
2 at random. Use these two equations to get the variables for the confidence interval:
2 1
2 1
count count
ns observatio total
successes total

n n
p
+
+
= =
and to
standardize:
|
|
.
|

\
|
+

=
2 2
2 1
1 1
) 1 (

n n
p p
p p
z

Use this method only when the population are at least 10 times larger than samples and the product of the number of success and the number of failures are each at least
10 in each sample.

Chapter 14
When we fit linear models before, we used them to describe the relationship between the variables, and we interpreted the slope and intercept as descriptions of the data.
Now wed like to know what the regression model can tell us beyond the sample we used to generate this regression. To do that, well want to make a confidence
interval and test hypotheses about the slope and intercept of the regression line. The data in a scatterplot are a random sample from a population that may exhibit a
linear relationship between x and y (different sample ->different plot)
Previously we had an equation of: = b0 + b1x,
Now we want to describe the population mean response y as a function of the explanatory variable x: y y = b0 + b1x, where o is the intercept and 1x is the slope,
which the above equation is the best estimate of.
Of course, not all the individual ys are at these means. In fact, the line will miss most and usually all of the plotted points. ome ys lie above and some below the line,
so like all models this one makes errors. If we want to account for each individual value of y in our model, we have to include these errors, which we denote by y =
o + 1x + ata=fit + residual, where the are independent and normally distributed. Linear regression assumes equal variance of y (SD is the same for all values
of x).
Estimating the Parameter- we estimate the Bs by finding a regression line, = b0 + b1x, as we did in chapter 6. The residual, e=y- , are the sample based versions of
the errors, . Our challenge since we know our estimates is to account for the uncertainty in our estimates by making confidence intervals. The regression standard
error, Se for n sample data points is calculated from the residuals, e=y- :
2
2

=

n
residual
s
e
.
Regression inference- the residuals give useful information about the contribution of individual data points to the overall pattern of scatter. If residuals are scattered
randomly around 0 with uniform variation, it indicates that the data fit a linear model, have normally distributed residuals for each value of x, and constant standard
deviation. Less scatter around the means the slope will be more consistent from sample to sample. Also the less scatter around the line, the stronger the relationship
between x and y. Good if residuals are randomly scattered. If its a curved pattern then the relationship is not linear. If theyre all over the place then there is a change in
variability across plot and SD is not equal for all values of x
CI for Regression Parameters- estimating the regression parameters o and 1 is a case of one-sample inference with unknown population variance. We rely on the t-
distribution, n-2 for degrees of freedom.
A level C confidence interval for the slope is proportional to the standard error of the least squares slope: b1 t* SE(b1)
A level C confidence interval for the intercept is proportional to the standard error of the least squares intercept: b0 t* SE(b0)
SE of Regression Coefficients- To estimate the parameters of the regression, we calculate the standard errors for the estimated regression coefficients. The standard
error of the least squares slop is:

1
) (
) (
2
1

n s
s
x x
s
b SE
x
e
i
e

The standard error of the least squares intercept is:


+ =
2
2
0
) (
1
) (
x x
x
n
s b SE
i
e

Significance test for the Slope- we can test the hypothesis H0: 1= 0 versus a 1 or 2 sided alternative. So when the assumptions are met we test the hypothesis using the
standardized estimated regression slope: t = b1 / SE(b1), which has a distribution of n-2 df. to find the P=value of the test. HA: 1<> or 0
Confidence interval for population mean(y)- using inference we can also calculate a confidence interval for the population mean of all responses y when x takes the
value x*: this interval is centered on y hat. The true values of the pop mean at a given x, will be within our CI level in x% of all intervals calculated from many different
samples. The level C CI for the mean response: y tn 2 * SE(), where the SE=

+ = + =
2
2 2
2
1
2
) (
) * ( 1
) * )( ( ) (
x x
x x
n
s
n
s
x x b SE SE
i
e
e

. The level C CI for a


single observation on y when x takes the value x* is t*n 2 E, where the standard error for predicting an individual response y is

+ + = + + =
2
2
2
2
2
1
2
) (
) * ( 1
1 ) * )( ( ) (
x x
x x
n
s s
n
s
x x b SE y SE
i
e e
e

You might also like