# I will first do a *very simple analysis* of what people call Raoult's data
# (actually: the data in Gautret et al. 2020a) under the
# “intention to treat principle”, with endpoint:
# alive outside of ICU *and* virus-free aftear 6 days; or not.
#
# I wrote these notes before becoming aware of the papers Gautret et al (2020b)
# or Hulme et al (2020). See end of this R script for the proper references.
#
# My chosen endpoint seems to me to be the most interesting and relevant endpoint.
# I furthermore *pretend* that this is a randomized clinical trial, i.e., I assume
# there are no systematic differences between ttreatment and control populations,
# even though the patients were treated in Marseilles and Nice by different
# medical teams. I do not know what criteria were used to "admit them" to
# Raoult's (Gautret's) experimental treatment in Marseilles. The criteria for
# admission in Nice to the so-called control group are also unknown.
#
# The 1 patient in the treatment group who was "cured on day 1" and "dropped out"
# was, let's hope and suppose, alive and virus-free after 6 days.
# Including this one is favourable to the treatment group.
# Gautret et al. (2020a) dropped this patient! I don't understand why.
#
# The four patients in the treatment group who went into ICU
# (and one of whom died) were not, I suppose, alive outside of ICU
# and virus-free after a total of 6 days. Little doubt about that.
# Including them is unfavourable to the treatment group.
# Gautret et al. (2020a) dropped these patients!!!! That is a cardinal error.
#
# The *full* "treatment group" of 26 admitted patients has, by my reckoning,
# 15 positive outcomes and 11 negative outcomes.
# (I'm supposing that the 14 "treated" patients who were virus-free
# after 6 days were moreover not in ICU at that time, either.)
#
# The *full* "control group" of 16 admitted patients has 2 positive outcomes
# and 14 negative outcomes.
#
# I would like to get, for a serious analysis of this data, values of
# all possibly relevant and probably known covariates such as age, sex,
# “severity of Corona infection”, “severity of existing conditions”,
# ethnicity, social economic class, educational level, smokers or non-smokers,
# weight and height ...
#
# We can talk about whether or not this trial can be combined with results
# of other trials later. Let’s first get this one sorted out.
#
# I will perform some alternative, simple, frequentist and Bayesian analyses.
#
# I start with using the very conventional "Fisher exact test", see
# https://stat.ethz.ch/R-manual/R-devel/library/stats/html/fisher.test.html.
# The model is: two independent binomials, and we condition on row and column
# totals, getting a hypergeometric distribution under the null hypothesis.
#
numbers <- matrix(c(15, 11, 2, 14), 2, 2, byrow = TRUE,
dimnames = list(c("treatment", "control"),
c("good outcome", "bad outcome")))
numbers
## good outcome bad outcome
## treatment 15 11
## control 2 14
fisher.test(numbers)
##
## Fisher's Exact Test for Count Data
##
## data: numbers
## p-value = 0.004491
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 1.575364 98.091226
## sample estimates:
## odds ratio
## 9.031585
# The treatment group does overwhelmingly better than the control group.
#
# Being "exact" has a disadvantage, namely reduction of power.
# The Barnard test does not have that disadvantage.
# https://www.rdocumentation.org/packages/Barnard/versions/1.6/topics/barnard.test
# The model is simply: two independent binomials.
library(Barnard)
barnard.test(15, 11, 2, 14)
##
## Barnard's Unconditional Test
##
## Treatment I Treatment II
## Outcome I 15 11
## Outcome II 2 14
##
## Null hypothesis: Treatments have no effect on the outcomes
## Score statistic = -2.89762
## Nuisance parameter = 0.232 (One sided), 0.407 (Two sided)
## P-value = 0.00227663 (One sided), 0.00409608 (Two sided)
# Just a tiny bit better p-value, same conclusion.
#
# Now a Bayesian analysis using the package "abtest". This is actually
# the hidden motor inside the package JASP, which I highly recommend.
# https://cran.r-project.org/web/packages/abtest/abtest.pdf
# https://jasp-stats.org/
# Warning: the description of abtest is inadequate, its output is misleading!
#
# The prior gives a 50-50 probability of "no difference at all". If there
# is a difference, it is supposed to be such that the log odds ratio is N(0,1)
# distributed. The logarithm used here is the natural logarithm.
# The model is: two independent binomials.
library(abtest)
ab_out <- ab_test(data = list(y1 = 11, n1 = 26, y2 = 14, n2 = 16),
posterior = TRUE)
print(ab_out)
## Bayesian A/B Test Results:
##
## Bayes Factors:
##
## BF10: 11.61384
## BF+0: 23.77204
## BF-0: 0.1589173
##
## Prior Probabilities Hypotheses:
##
## H+: 0.25
## H-: 0.25
## H0: 0.5
##
## Posterior Probabilities Hypotheses:
##
## H+: 0.9167
## H-: 0.0061
## H0: 0.0771
plot(ab_out)


# Note: I see errors in the description of the output of ab_test() !!!!
plot_posterior(ab_out, what = "logor") # This is the posterior, conditional on inequality!


# Posterior probability that odds of a good outcome are more than 20% better:
logOR <- ab_out$post$H1$logor
(1 - ab_out$post_prob["H0"]) * mean(logOR > log(1.2))
## H0
## 0.9087522
# Note: I found errors in the description of the output of ab_test() !!!!
# It is again clear that there is large probability that the treated population
# does better. However the probability is no longer the very exciting p-value
# of 0.0044 (or, Barnard test, 0.0041), but a less impressive 92%.
# There remains 0.6% probability that the treated population fares worse.
# There is still an 8% chance that there is no difference at all!
#
# The probability that the treated population does a clinically interesting
# more than 20% better is the less impressive 91%.
#
# The two populations with their two different treatments seems to be doing
# differently 6 days after admission. Whether that is caused by their
# differing treatments or because they are different patients being referred
# by different doctors to different clinics in different places,
# remains to be studied.
# With almost no information whatsover about any possible confounders,
# so everyone can have their own opinion about this.
#
# References: Gautret et al (2020a), Gautret et al (2020b), Hulme et al (2020).
# https://doi.org/10.1016/j.ijantimicag.2020.105949
# https://doi.org/10.1016/j.tmaid.2020.101663
# https://osf.io/5dgmx/
#