1
$\begingroup$

I suppose that this is a very simple question, and I have just now recently started doing stats.

I am working on a dataset with count data relating to discontinuation/continuation of a specific injectable drug, and I created a contingency table that looked like this:

Discontinued Stayed
2018 2084 663
2019 1916 1207

I ran a Pearson's chi square test with Yates' continuity correction, which gave me a significant association. I ran Fisher's exact test to find out the odds ratio.

I have two questions. First, is it appropriate for me to use year as one of the categorical variables in a chi square test? If so, is it okay for me to interpret that "individuals in 2019 were nearly twice as likely to continue using the contraceptive after the first dose, compared to those in 2018?" I am not entirely sure how to interpret the results of this chi square test, or if chi square is the most appropriate test for this scenario. Here is what I ran in R:

tab <- matrix(c(2084,663,1916,1207)
              , ncol=2, nrow=2, byrow = TRUE)
colnames(tab) <- c('Discontinued', 'Stayed')
rownames(tab)<-c('2018','2019')
tab <- as.table(tab)
print(tab)
chisq.test(tab)
fisher.test(tab)

Results of the test

> chisq.test(tab)

    Pearson's Chi-squared test with Yates' continuity correction

data:  tab
X-squared = 141.14, df = 1, p-value < 2.2e-16

> fisher.test(tab)

    Fisher's Exact Test for Count Data

data:  tab
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 1.765474 2.221507
sample estimates:
odds ratio 
   1.97993 
$\endgroup$
1
  • 1
    $\begingroup$ "individuals in 2019 were nearly twice as likely to continue using the contraceptive after the first dose, compared to those in 2018?" - to me that suggests relative risk rather than odds ratio. $\endgroup$ Feb 6 at 11:39

2 Answers 2

2
$\begingroup$

If you run logistic with glm, you get:

year <- c(rep("2018", 2084+663), rep("2019",1916+1207))
drug <- c(rep(0, 2084), rep(1, 663), rep(0, 1916), rep(1, 1207))

model <- glm(drug ~ year, family=binomial(link="logit"))
summary(model)

exp(0.68317)
exp(confint(model))

where the two exp() functions are used to obtain the odds ratio and the confidence interval for the odds ratio. The results are:

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -1.14527    0.04459  -25.68   <2e-16 ***
year2019     0.68317    0.05778   11.82   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 7346.7  on 5869  degrees of freedom
Residual deviance: 7203.2  on 5868  degrees of freedom
AIC: 7207.2

Number of Fisher Scoring iterations: 4

> exp( 0.68317)
[1] 1.980145

> exp(confint(model))
Waiting for profiling to be done...
               2.5 %    97.5 %
(Intercept) 0.291319 0.3469683
year2019    1.768659 2.2182985

So "exactly" the same odds ratio and CI as you got with the Fisher exact test, like Peter Flom already said.

The confidence interval shows you that the null hyposthesis "oddsratio = 2" would not have to be rejected. However, I think you would not want to test such an explicit hypothesis about the true value of the oddsratio (in the population, say). The Fisher test gives you all you want, you can now say that the two odds values differ significantly, the one for 2019 "being about two as high". This final addition however only "descriptive", because as I said above, I think you would not like to really test that explicitly.

$\endgroup$
2
  • $\begingroup$ Agreed with most of your answer, but shouldn't OP just report the confidence interval, and refrain from saying anything like "being about two as high"? (or at least, mentioning that this kind of observation is applicable only to the sample, not to the population?). As OP question is about an injectable drug, it's likely that the point of the analysis is inference, not simple description of the sample (but I may be mistaken!). $\endgroup$
    – J-J-J
    Feb 5 at 10:53
  • $\begingroup$ @J-J-J Good point, one has to be careful with making such statement. On the other hand, this is quite a big sample. Still, a conclusion like "being about twice as high for these data" would be safer to say. $\endgroup$
    – BenP
    Feb 5 at 12:43
0
$\begingroup$

Because there are only two years, a chi-square test is appropriate. Your specific test indicates that there is codependence: the "discontinued"/"stayed" status depends on the year.

You ask: "... is it okay for me to interpret that individuals in 2019 were nearly twice as likely to continue using the contraceptive after the first dose, compared to those in 2018?" No, it is not ok. To make those type of statements, you could run logistic regression. It provides the researcher with odds, among other things.

$\endgroup$
11
  • $\begingroup$ Why wouldn't a chi-squared test be appropriate if there were more than two years? $\endgroup$
    – J-J-J
    Feb 4 at 8:29
  • $\begingroup$ It would be valid but not most powerful. When ordinal X is explored in connection with categorical Y, the ordinal nature of X has to be exploited to achieve highest discerning capability. X should not be "misunderstood" and viewed as categorical. Ex: there is information in the fact that 2019 comes in-between 2018 and 2020. Ignoring that is throwing power out of the window. $\endgroup$
    – stans
    Feb 4 at 10:35
  • 1
    $\begingroup$ OP got the OR from Fisher's exact test. Why would he need to run logistic as well? Actually, in a 2x2 table, it's easy to get the OR by hand $\endgroup$
    – Peter Flom
    Feb 4 at 11:00
  • $\begingroup$ @stans So, to clarify. I need to fit a logistic regression model to provide a significant OR, and and OR from a chi square is not sufficient enough. $\endgroup$ Feb 4 at 15:19
  • $\begingroup$ Whenever one makes any prediction or assessment, one has to put a confidence interval around it. Logit, probit and similar models allow you to do that. Chi-square test doesn't. It is not enough to say: oh, look A seems to be bigger than B. $\endgroup$
    – stans
    Feb 5 at 4:50

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.