Math 132B

Class 27

Categorical variables

  • Two or more levels

  • Proportion of one of the levels (success)

  • Proportions of all the levels (distribution)

  • Comparison of proportions or distributions between groups (two categorical variables)

Advanced melanoma

Advanced melanoma is an aggressive form of skin cancer that until recently was almost uniformly fatal.

Research is being conducted on therapies that might trigger an immune response to the cancer and cause the melanoma to stop progressing or disappear entirely.

In a study where 52 patients were treated concurrently with two new therapies, nivolumab and ipilimumab, 21 had an immune response. (Wolchok, et. al. NEJM (2013) 369(2): 122-33.)

Advanced melanoma…

Questions that can be addressed with inference…

  • What is the estimated population probability of immune response following concurrent therapy with nivolumab and ipilimumab?

  • What is the 95% confidence interval for the estimated population probability of immune response following concurrent therapy with nivolumab and ipilimumab?

  • In previous studies, the proportion of patients responding to one of these agents was 30% or less. Do these results suggest that the probability of response to concurrent therapy is better than 0.30?

Inference for binomial proportions

The melanoma data are binomial data, with success defined as experiencing an immune response.

  • Inference is made about the population parameter \(p\), the probability of success in the population.

  • The estimate of \(p\) from the observed sample is \(\hat{p} = x/n\), where \(x\) is the observed number of successes.

  • The test statistic can be \(x = n\hat{p}\) (the number of successes) which has \(\operatorname{Binom}(n, p)\) distribution.

  • We can also use \(\hat{p}\) as the test statistic. We know that \(n\hat{p} \sim \operatorname{Binom}(n, p)\).

Sampling distribution

We could use binomial distribution as sampling distribution

  • Hard to work with when samples are large.
  • Discrete distribution, makes finding quantiles tricky.

Under certain assumptions, binomial distribution can be approximated by normal distribution.

  • Expected number of successes and failures must be large enough
  • Use \(\mu = n\cdot p\) and \(\sigma = \sqrt{n\cdot p \cdot (1-p)}\).

Sampling distribution

  • Number of successes: \[x \sim \operatorname{Norm}(np, \sqrt{npq})\]

  • Proportion of successes: \(\hat{p} = \frac{x}{n}\), so we divide by \(n\) and get \[\hat{p} \sim \operatorname{Norm}\left(p, \sqrt{\frac{pq}{n}}\right)\]

Assumptions for using the normal distribution

The sampling distribution of \(\hat{p}\) is approximately normal when

  1. The sample observations are independent, and

  2. At least 10 successes and 10 failures are expected in the sample: \(np \geq 10\) and \(n(1-p) \geq 10\). (This condition is commonly referred to as the success-failure condition.)

Under these conditions, \(\hat{p}\) is approximately normally distributed with mean \(p\) and standard error \(\sqrt{\frac{p(1-p)}{n}}\).

When computing an interval estimate, \(p\) is unknown, so we substitute \(\hat{p}\) for \(p\) when using the standard error of \(\hat{p}\).

Inference with normal approximation

In the context of calculating CIs, substitute \(\hat{p}\) for \(p\).

An approximate two-sided confidence interval for \(p\) is given by \[\hat{p} \pm z^\star \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}. \]

Example: \(x = 21\), \(n = 52\), find 95% CI for \(p\).

prop.test(x = 21, n = 52, conf.level = 0.95)$conf.int
[1] 0.2731269 0.5487141
attr(,"conf.level")
[1] 0.95

Inference with normal approximation

In the context of hypothesis testing, substitute \(p_0\) for \(p\).

The test statistic \(z\) for the null hypothesis \(H_0: p = p_0\) is \[z = \dfrac{\hat{p} - p_0}{\sqrt{\dfrac{(p_0)(1 - p_0)}{n}}} \]

Example: \(x = 21\), \(n = 52\), test \(H_0: p = 0.30\), \(H_A: p > 0.30\).

prop.test(x = 21, n = 52, p = 0.30, alternative = "greater")

    1-sample proportions test with continuity correction

data:  21 out of 52
X-squared = 2.1987, df = 1, p-value = 0.06906
alternative hypothesis: true p is greater than 0.3
95 percent confidence interval:
 0.2906582 1.0000000
sample estimates:
        p 
0.4038462 

Inference with normal approximation

Exact inference for binomial data

Using the binomial distribution:

p-value is \(P(x \ge 21 \vert p = 0.30)\)

pbinom(20, size = 52, p = 0.30, lower.tail = FALSE)
[1] 0.07167176

The exact binomial test:

binom.test(x = 21, n = 52, p = 0.30, alternative = "greater")



data:  21 out of 52
number of successes = 21, number of trials = 52, p-value = 0.07167
alternative hypothesis: true probability of success is greater than 0.3
95 percent confidence interval:
 0.2889045 1.0000000
sample estimates:
probability of success 
             0.4038462 

Exact inference for binomial data

Another option: simulation

do(10000) * rflip(52, prob = 0.30) -> sims
prop(~(heads >= 21), data = sims)
prop_TRUE 
    0.068 

Another option: simulation

Comparison of all three

Inference for the difference of two proportions

  • Difference of two independent normally distributed variables is normally distributed.

  • The mean is the difference of the two means.

  • The variance is the sum of the two variances.

  • The standard deviation is the square root of the sum of the two variances.

  • The normal model can be applied to \(\hat{p}_1 - \hat{p}_2\) if

    1. The two samples are independent, the observations in each sample are independent, and

    2. At least 10 successes and 10 failures are expected in each sample.

Inference for the difference of two proportions

The standard error of the difference in sample proportions is \[\sqrt{\dfrac{p_1(1 - p_1)}{n_1} + \dfrac{p_2(1 - p_2)}{n_2}} \]

In hypothesis testing, the following estimate of \(p\) is used to compute the standard error: \[\hat{p} = \dfrac{n_1\hat{p}_1 + n_2\hat{p}_2}{n_1 + n_2} = \dfrac{x_1 + x_2}{n_1 + n_2} \]

Use this for both \(p_1\) and \(p_2\).

Are metal bands used for tagging harmful to penguins?

Researchers (Saraux at al., 2011) wanted to know whether metal bands used for tagging penguins are harmful. They selected a random sample of 100 penguins, tagged them with RFID chips, and tagged 50 of them with metal bands. After about 4 years, they checked how many penguins in each group survived.

Data

Results

        group
survived band control
   TRUE    16      31
   FALSE   34      19

The same with proportions:

        group
survived band control
   TRUE  0.32    0.62
   FALSE 0.68    0.38

What does it mean?