Even more two sample tests!
Comparing variance of two samples (F-test)
- When comparing means, we looked at the difference
. - For comparing variances, instead we'll use quotients
.
Recall. The
(testing variance) (goodness-of-fit & independence)
Now. We will use the
where
The F distribution has mean
Note. Reversing the degrees of freedom flips the F distribution.
Similar to
Assumption:
and are independent, normal with means , and variances ,
Setup:
is sampled times: ⟶ sample variance is sampled times: ⟶ sample variance
Null Hypothesis:
- H0:
Statistic:
If the null hypothesis is true, then
=
is distributed as
(Note that flipping
P-value:
The
(Note that we can arrange for
Cutoffs:
The cutoff values (boundary for CI) are:
Note that
Example:
Suppose that we get
X <- rnorm(20, 20, 8)
Y <- rnorm(40, 24, 5)
Our statistic will be
F <- sd(X)^2 / sd(Y)^2
F
I prefer to take left-tail probabilities, so I'm going to flip everything.
F <- 1/F
F
The p-value will be
Since I flipped
p <- 2*pf(F,39,19)
p
The command to do this in R is
var.test(...)
var.test(X,Y)
Comparing two population proportions.
Let's return to our earlier example of population proportions. Previously we did a one-sample test comparing a sample population proportion
and we want to test against equality.
Setup:
- Perform
Bernoulli trials on one population to get - Perform
Bernoulli trials on another population to get
(Note that
Assumptions:
is is
Null Hypothesis:
- H0:
Statistic:
Our textbook suggests that
mean
variance
Our textbook suggests pooling to estimate
is approximately standard normal (under the null hypothesis)
Example:
Suppose that we make
X <- 21; n <- 50
Y <- 53; m <- 80