2
$\begingroup$

I have a dummy variable for health (0 or 1), and for each observation a treatment (one of three possible treatments for each observation). I want to test the null hypothesis that the proportion (mean) healthy within each treatment group is not significantly different than any other treatment group's proportion. \begin{align} H_0\!: P_j = P_{j'}\quad &\text{for some } j \ne j' \\ H_A\!\!: P_j\ne P_{j'}\quad &\text{for all } j \ne j' \end{align} That is, my alternative hypothesis is that every proportion (mean) is different than every other proportion. My data looks something like this:

treatment, health
1,         1
1,         0
2,         0
2,         0
3,         1
3,         1
...
$\endgroup$
1
  • $\begingroup$ I think the simplest way to achieve this would be to test each pair. Your composite null is kind of tricky. $\endgroup$
    – Glen_b
    Commented Apr 20, 2014 at 22:18

1 Answer 1

0
$\begingroup$

You can use a multiple-degrees of freedom test and logistic regression. I will show this with some R code. First simulating some data:

p <- c(0.5, 0.5, 0.25)
set.seed(7*11*13)# public seed 
m <- 40
N <- 3*m
T <- as.factor(rep(1:3, rep(m, 3)))
Y <- rbinom(N, 1, rep(p, rep(m, 3)))

The null hypothesis is that $p_2=p_3$ and $p_1=p_3$ (and $p_1=p_2$, but that is already implied by the first two). We can represent that with a contrast hypothesis with two rows. We fit a logistic regression model without intercept, to get one parameter for each group. Note that since this is a saturated model, some other link function would give the same estimated probabilities.

library(car)# for car::linearHypothesis
mod <- glm(Y ~ 0+T, family=binomial() )
summary(mod) # output not shown

car::linearHypothesis(mod, rbind(c(0, 1, -1),
                            c(1, 0, -1)), test="Chisq", verbose=TRUE)

Hypothesis matrix:
     [,1] [,2] [,3]
[1,]    0    1   -1
[2,]    1    0   -1

Right-hand-side vector:
[1] 0 0

Estimated linear function (hypothesis.matrix %*% coef - rhs)
[1] 1.2367626 0.9344818


Estimated variance/covariance matrix for linear function
         [,1]      [,2]
[1,] 0.243369 0.1433690
[2,] 0.143369 0.2456708

Linear hypothesis test

Hypothesis:
T2 - T3 = 0
T1 - T3 = 0

Model 1: restricted model
Model 2: Y ~ 0 + T

  Res.Df Df Chisq Pr(>Chisq)  
1    119                      
2    117  2 6.548    0.03785 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1  
$\endgroup$
3
  • $\begingroup$ "The null hypothesis is that $p_2 = p_3$ and $p_1 = p_3$" I believe that there is a composite null hypothesis rather than a single point hypothesis $p_1=p_2=p_3$. E.g the null hypothesis includes any of the four situations $$\begin {array}{}p_1=p_2 \neq p_3\\p_2=p_3 \neq p_1\\p_1=p_3 \neq p_2\\p_1 = p_2 = p_3\end {array} $$ $\endgroup$ Commented Jan 23, 2019 at 14:35
  • $\begingroup$ What I have done is to formulate a composite hypothesis? so I cannot see what is wrong. This then must be tested simultaneouls, using a contrast matrix. $\endgroup$ Commented Jan 23, 2019 at 14:49
  • $\begingroup$ You state that the null hypothesis/effect is $p_1=p_2$ and $p_1=p_3$, but it should be or. $\endgroup$ Commented Jan 23, 2019 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.