# Distributionally Robust Recurrent Decoders
with Random Network Distillation

Antonio Valerio Miceli Barone
University of Edinburgh
<EMAIL_ADDRESS>
&Alexandra Birch
University of Edinburgh
<EMAIL_ADDRESS>
&Rico Sennrich
Universität Zürich
<EMAIL_ADDRESS>

###### Abstract

Neural machine learning models can successfully model language that is similar
to their training distribution, but they are highly susceptible to degradation
under distribution shift, which occurs in many practical applications when
processing out-of-domain (OOD) text. This has been attributed to "shortcut
learning": relying on weak correlations over arbitrary large contexts. We
propose a method based on OOD detection with Random Network Distillation to
allow an autoregressive language model to automatically disregard OOD context
during inference, smoothly transitioning towards a less expressive but more
robust model as the data becomes more OOD, while retaining its full context
capability when operating in-distribution. We apply our method to a GRU
architecture, demonstrating improvements on multiple language modeling (LM)
datasets.

Distributionally Robust Recurrent Decoders
with Random Network Distillation

Antonio Valerio Miceli Barone University of Edinburgh<EMAIL_ADDRESS>Alexandra Birch University of Edinburgh<EMAIL_ADDRESS>Rico Sennrich
Universität Zürich<EMAIL_ADDRESS>

##  1 Introduction

Neural language models have become the main component of modern natural
language processing systems, with larger and larger models being used as
feature extractors for downstream tasks (Devlin et al., 2019), as probability
estimators for ranking and ensembling (Gulcehre et al., 2015) or as language
generators (Bahdanau et al., 2015; Vaswani et al., 2017; Brown et al., 2020).

Despite their success, neural machine learning models can suffer large
performance degradation when they are applied to out-of-domain data which is
substantially different than their training data (Lapuschkin et al., 2019;
Hupkes et al., 2019; Recht et al., 2019).

Unlike the older statistical language models, Recurrent LMs (RNNLMs) (Mikolov
et al., 2010) and their successors Transformers LMs (Vaswani et al., 2017) can
consider the entire prefix of a sentence when predicting or generating the
next token. By being able to relate a very high-dimensional input to the
output, these models can learn many subtle correlations which are highly
useful as long as the input is in-distribution, unfortunately these
correlations tend to be brittle to distribution shift, causing a model that
depends on them to go astray. This phenomenon is known as "shortcut learning"
(Geirhos et al., 2020) and it has been found to also occur in humans and
animals, but it is especially prevalent in artificial neural networks.
Research on this problem has explored models invariant or equivariant w.r.t.
certain transformations by means of compositional representations (Sabour et
al., 2017; Soulos et al., 2019; Liu et al., 2020), causal modeling (Schölkopf
et al., 2021), or both (Arjovsky et al., 2019; Krueger et al., 2020), but
these works focus on classification tasks often on synthetic datasets and
can’t be straightforwardly applied to black-box language models. Approaches
specific to LMs have focused on robustness where the data domains are known
and represented in the training data (Oren et al., 2019; Gerstenberger et al.,
2020).

In this work we propose a method that uses Random Network Distillation (RND)
(Burda et al., 2018) to dynamically adapt the amount of context that the model
relies upon during inference based on an estimate of how much this context is
out-of-distribution (OOD). This way the model can still make use of all
available context when operating within a familiar context space, exploiting
long-distance weak correlations, but it reduces to a less expressive and more
robust model when operating OOD, relying only on the strongest correlations.
As a proof of concept we implement our approach on a GRU recurrent language
model (Cho et al., 2014). While Transformer decoders outperform RNNs when
trained on large training sets, RNNs remain competitive on smaller datasets
($<10^{7}$ tokens) where OOD phenomena are easier to measure, furthermore they
are easier to optimize, simplifying architecture and hyperparameter search. We
evaluate our method on language modeling tasks on English datasets, obtaining
improvements when evaluating on eight OOD domains.We report additional
preliminary sequence-to-sequence results on Transformer-RNN models (Zhang et
al., 2018) in appendix A. We leave extensions of our method to full
Transformers as future research.

##  2 Background

### Recurrent Language Model

Given a sequence $x(t)$ of tokens encoded as one-hot vectors, an
autoregressive causal recurrent language model estimates at each step $t$ a
probability distribution $\Pr(x(t+1)|x(0),\dots,x(t))=y(t+1)$ over the next
token conditional on the observed prefix which is summarized as a fixed-
dimensional state $h(t+1)\in\mathcal{R}^{d}$ computed according to the
recurrence relation:

$\displaystyle u(t)$ $\displaystyle=\text{Emb}(x(t),\theta)$ (1)
$\displaystyle h(0)$ $\displaystyle=0^{\otimes d}$ (2) $\displaystyle h(t+1)$
$\displaystyle=\text{RNN}(h(t),u(t),\theta)$ (3) $\displaystyle y(t+1)$
$\displaystyle=\text{Proj}(h(t+1),\theta)$ (4)

where Emb is an embedding layer, RNN is a recurrent cell (in our case, a GRU),
Proj is a readout layer (we use a mixture-of-softmaxes layer (Yang et al.,
2018)) and $\theta$ represents all the trainable parameters. The initial state
$h(0)$ is fixed at zero.

An interesting property of this model is that close to the beginning of the
sequence the state vector $h(t)$ has a small norm, and the entropy of the
predicted token distribution is usually high because many tokens are
plausible, while as more and more tokens are observed the state norm grows
(token embeddings are approximately "added" to the state (Levy et al., 2018))
up to a point, and at the same time the entropy of the predicted token
distribution decreases as the model becomes more confident of its prediction
due to the larger observed context (Figure 1). Indeed, in a softmax readout
layer:

$\displaystyle\text{Proj}(h)=\text{softmax}(W\cdot h+b)$

where $W$ is the output projection matrix and $b$ is the output bias vector,
increasing the norm of the state vector $h$ will usually cause the probability
distribution to become sharper unless $W\cdot h$ happens to approximately
cancel out the bias vector $b$, which in high dimensions requires a rather
specific alignment. A mixture-of-softmaxes readout also exhibits this
property. Furthermore, it has been observed that the state of a RNN is usually
dominated by the most recently observed inputs as the contribution of past
inputs decreases exponentially over time (Jaeger, 2001; Pascanu et al., 2013;
Levy et al., 2018; Zhang and Sennrich, 2019). Therefore, we hypothesize that
the norm of the state vector corresponds to the amount of context that the
model is considering for its future predictions, and this in turn controls the
confidence of the model in its predictions.

Figure 1: L2-norm of top GRU state (blue dots) and output softmax entropy (red
crosses) over BPE token position, averaged over in-domain test set (Penn
Treebank). Sentences are evaluated independently starting from the zero state.
Norm and entropy correlate at $-0.58$. Model trained on Penn Treebank (sec.
4).

### Random Network Distillation

In order to estimate how much the state of our RNNLM has deviated from the
training distribution we choose the Random Network Distillation (RND) approach
(Burda et al., 2018; Ciosek et al., 2020). Given a representation $h$, we
define an OOD detector as

$\text{OOD}(h)=|T(h)-S(h,\phi)|^{2}$ (5)

where $T(h)$ is a randomly initialized and frozen feed-forward teacher network
that pseudo-randomly maps the state $h$ to a high-dimensional output and
$S(h,\phi)$ is a feed-forward student network with parameters $\phi$ trained
to copy the teacher by minimizing eq. 5 on the training set. At inference time
the distillation error of eq. 5 provides an OOD estimate of $h$. This works by
deliberately exploiting the fragility of neural networks w.r.t. distribution
shift: while in principle the student could learn to copy the teacher for all
possible inputs, in practice it only learns to do so on the training set (in-
domain by definition) and becomes increasingly uncorrelated to it as the input
becomes more OOD. See Ciosek et al. (2020) for an extensive analysis. We chose
this method because it can be applied to internal representations, is
completely unsupervised and does not require any OOD tuning data. RND has been
proposed initially in the context of reinforcement learning where the OOD
signal can be used as a “curiosity” reward to stimulate exploration, and it
has been subsequently studied in the context of OOD estimation for image
classification. To our knowledge, we are the first to apply it to NLP, and to
use it to actively compensate for distribution shift rather than just measure
it.

##  3 Proposed approach

Our approach consists of estimating how much out-of-distribution the state of
the model is and scaling it towards the all-zero initial state accordingly,
effectively purging the OOD context out of the memory of the model and forcing
it to rely only on the strongest, usually short-distance, correlations that
survive the purge. As the state is pushed towards zero, the model also becomes
more conservative in its predictions, avoiding the typical overconfidence of
neural networks in OOD conditions. Specifically, for our language modeling
experiments, we train a GRU RNNLM as usual, then we freeze it and train a RND
OOD estimator on the RNNLM states on the same training set. Then during
inference we modify the recurrence relation (eq. 3) to

$\displaystyle\tilde{h}$ $\displaystyle=\text{RNN}(h(t),u(t),\theta)$ (6)
$\displaystyle h(t+1)$
$\displaystyle=\tilde{h}\cdot\alpha\exp(-\beta\cdot\text{OOD}(\tilde{h}))$ (7)

where we use a simple exponential scaling with $\alpha$ and $\beta$
hyperparameters111$\alpha$ can also be tuned by SGD on the training set, but
we found this to be unnecessary. which we set to $1$. When the OOD signal is
zero the model behaves like the baseline RNNLM, when it is high instead it
behaves more like a unigram language model. This way, we can retain the
expressivity of "shortcut learning" when it is beneficial, and hopefully avoid
its influence when it is detrimental.

##  4 Experiments

### Setup

For all our language modelling experiments we use two-layer stacked GRUs, with
a PyTorch implementation based on code by Zhang and Sennrich
(2019)222https://github.com/bzhangGo/lrn. We train separate models on the Penn
Treebank and Wikitext-2 corpora using the default hyperparameters provided by
the codebase. We also train models on BPE subtokenized (Sennrich et al., 2016)
versions of the corpora using
SentencePiece333https://github.com/google/sentencepiece . These models are
used both as baselines and to provide the initial models for our approach. For
our approach we train one RND OOD model for each layer of the RNNLM, the
teachers are 2-layer LeakyReLU MLPs (Maas et al., 2013) with layer
normalization (Ba et al., 2016) and the students are like the teachers
followed by 4 Resnet blocks (He et al., 2016) with 2 LeakyReLU MLP layers
each. All hidden dimensions are set to match the RNNLM state dimension. For
consistency with the original codebase, we use SGD with decaying learning rate
and early stopping to train the baseline RNNLMs, while we switch to Adam
(Kingma and Ba, 2015), with constant learning rate and early stopping when
training the RND OOD estimator. GRU hyperparameters are the default ones from
the reported Penn Treebank and Wikitext-2 models of the baseline
implementation. The code to run the experiments is
available.444https://github.com/Avmb/lm-robustness

### Perplexity estimation

| in-domain |  | Müller et al. (2020) | MTNT
---|---|---|---|---
| Penn | WT-2 | IT | Koran | Law | Med | Sub | fr-en.en | ja-en.en
word-level
Baseline | 68.04 |  0055.73 |  0059.37 |  0050.12 |  0064.12 |  0035.10 |  0047.81 |  0076.75 |  0066.08
RND | 67.86 |  0055.00 |  0058.18 |  0049.12 |  0062.94 |  0034.67 |  0047.01 |  0075.33 |  0064.73
RND (abl.) | 67.84 |  0055.41 |  0059.02 |  0049.76 |  0063.67 |  0034.99 |  0047.55 |  0076.25 |  0065.64
BPE-level
Baseline | 27.85 | 1371.16 | 5657.39 | 5493.64 | 4123.78 | 5657.54 | 4048.14 | 2837.97 | 4051.66
RND | 28.16 | 1197.07 | 4828.55 | 4774.78 | 3552.22 | 4520.38 | 3558.99 | 2519.75 | 3551.63
RND (abl.) | 27.93 | 1287.26 | 5178.40 | 5159.36 | 3815.87 | 4898.91 | 3792.19 | 2675.51 | 3794.22
Table 1: Perplexity of language models trained on the Penn Treebank dataset. | in-domain |  | Müller et al. (2020) | MTNT
---|---|---|---|---
| WT-2 | Penn | IT | Koran | Law | Med | Sub | fr-en.en | ja-en.en
word-level
Baseline | 64.69 | 361.84 | 162.01 | 159.02 | 178.92 | 103.87 | 96.65 | 177.73 | 184.69
RND | 64.69 | 333.52 | 156.73 | 156.59 | 171.42 | 102.33 | 100.46 | 175.34 | 180.54
RND (abl.) | 64.69 | 338.33 | 157.96 | 155.75 | 172.94 | 102.74 | 98.82 | 174.20 | 180.91
BPE-level
Baseline | 29.39 | 190.91 | 648.84 | 694.86 | 339.46 | 355.74 | 563.92 | 495.39 | 497.27
RND | 29.73 | 183.23 | 637.63 | 712.93 | 335.86 | 348.16 | 656.86 | 530.45 | 526.30
RND (abl.) | 29.46 | 185.48 | 632.52 | 695.54 | 334.37 | 347.75 | 624.27 | 515.16 | 512.96
Table 2: Perplexity of language models trained on the Wikitext-2 dataset. |  |  | Müller et al. (2020) | MTNT
---|---|---|---|---
Training | WT-2 | Penn | IT | Koran | Law | Med | Sub | fr-en.en | ja-en.en
WT-2 |  0.0240* | 0.1137 | 0.0735 | 0.1155 | 0.0767 | 0.0485 | 0.0936 | 0.1070 | 0.0896
Penn | 0.0237 | 0.0252* | 0.0244 | 0.0233 | 0.0244 | 0.0234 | 0.0236 | 0.0240 | 0.0238
WT-2 (BPE) |  0.0220* | 0.0534 | 0.1054 | 0.1824 | 0.0697 | 0.0657 | 0.1472 | 0.1328 | 0.1196
Penn (BPE) | 0.0256 | 0.0257* | 0.0321 | 0.0279 | 0.0313 | 0.0359 | 0.0300 | 0.0308 | 0.0302
Table 3: OOD estimates, averaged over GRU layers and tokens in each test set.
* denotes the in-domain test sets.

We investigate OOD performance with two standard corpora, Penn Treebank and
Wikitext2. We evaluate each of the models both in-distribution, on the default
test set of its training corpus, and out-of-distribution, on the test set of
the other corpus. We also use additional test sets adapted from machine
translation robustness evaluations, specifically the English sides of the De-
En test sets of Müller et al. (2020), which is a collection of corpora from
diffent domains (I.T., Koran, law, medical and movie subtitles) and the
English sides of the MTNT Ja-En and Fr-En test sets of Michel and Neubig
(2018), which are corpora scraped from Reddit and have been used for the
WMT-19 robustness shared task (Li et al., 2019).

We report the results in tables 1 and 2. We find that for the word-level
models trained on Penn Treebank our approach improves the perplexity
consistently both in-distribution and out-of-distribution for all the test
sets we considered. For the word-level models trained on Wikitext-2 our
approach has a slightly worse perplexity in-distribution but improves on most
OOD test sets, namely Penn Treebank test set, the Ja-En test set of the MTNT
corpus and all the tests sets of Müller et al. (2020) except the Koran and
subtitles test sets. The Penn Treebank results are somewhat anomalous in that
the perplexity of some OOD test sets is lower than the perplexity of the in-
distribution test sets (and in fact the perplexity of the Wikitext-2 test set
is even lower that the perplexity of the same test set evaluated by its own
in-domain model). This effect is caused by the limited vocabulary of the Penn
Treebank training set which causes many of the tokens of the OOD test sets to
be replaced by UNKs, which are easy to predict. To avoid this artifact, we
evaluate BPE-level models, which are open vocabulary and hence do not
introduce any UNKs. For the BPE-level models we find that for both the
baselines and the RND approach the perplexities on the OOD datasets are much
higher than the perplexities on the in-domain test sets. Comparing our
approach to the baselines, we observe a minimal degradation of perplexity in-
distribution and substantial improvements on all OOD test sets when training
on Penn Treebank, while when training on Wikitext-2 we observe more mixed
results.

In order to analyse if the model is learning sensible values for scaling the
out-of-distribution states, we compute the OOD scores estimated by the RND OOD
detectors, averaged over the two GRU layers and over all the tokens in each
test set. We report these scores in table 3. The models trained on Wikitext-2
(both the word-level and BPE-level versions) always estimate the lowest OOD
scores on the in-domain test set, as expected. The Penn Treebank word-level
model performs poorly, estimating similar scores for all the test sets,
consistent with the aforementioned vocabulary collapse to UNKs, the BPE-level
model instead is generally able to distinguish in-domain and out-of-domain
test sets, albeit by a small margin and fails on one test set (Wikitext-2).

### Ablation

One could hypothesize that the improvements obtained by our model are due to
just increasing the entropy of the output distribution rather than dropping
unnecessary context from the RNN state. We evaluate a variant of our model
where we apply the OOD scaling only on the output of the top-layer RNN but not
to the internal states. This increases the output entropy without affecting
the context remembered by the model between time steps. This ablation
generally improves over the baseline but performs worse than our full model
except for the model trained on Wikitext-2 BPE where the results are mixed.

##  5 Conclusions and future work

We proposed a method to improve the robustness of language models to
distribution shift caused by train/test domain mismatch. Our model contracts
the RNN state based on an unsupervised out-of-distribution estimator in order
to reduce the model dependency on weak long-distance correlations, which are
useful in-distribution but tend to be spurious in out-of-distribution
conditions. We obtain perplexity improvements on multiple out-of-domain test
sets without substantial degradation on in-domain test sets.

While our approach is based on Recurrent decoders, its general principles may
be applicable to other neural architectures. For instance, the self-attention
heads of a Transformer might modulated by an OOD detector in order to avoid
attending to out-of-distribution parts of a sentence. We anticipate that
extending our method to these kind of models will be a promising research
direction.

## Broader impact and ethical concerns

This work provides improvements for language model technology on application
domains not well represented in the training data.

We expect that our approach might promote an increased deployment and usage of
such technology. We do not expect our approach to introduce any bias against
any specific group of users. Our approach adds only small computational costs
over baseline language models and therefore is unlikely to prevent users with
limited computational budgets from benefiting from the technology.

## Acknowledgments

This project received funding from the European Union’s Horizon 2020 research
and innovation programme under grant agreement 825299 (GoURMET), the European
Research Council (ERC StG BroadSem 678254; ERC CoG TransModal 681760) and
funding by the UK Engineering and Physical Sciences Research Council (EPSRC)
fellowship grant EP/S001271/1 (MTStretch).

## References

  * Arjovsky et al. (2019) Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. 2019.  Invariant risk minimization.  _arXiv preprint arXiv:1907.02893_.
  * Ba et al. (2016) Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. 2016.  Layer normalization.
  * Bahdanau et al. (2015) Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015.  Neural machine translation by jointly learning to align and translate.  In _3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings_.
  * Brown et al. (2020) Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020.  Language models are few-shot learners.
  * Burda et al. (2018) Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. 2018.  Exploration by random network distillation.  _arXiv preprint arXiv:1810.12894_.
  * Cettolo et al. (2014) Mauro Cettolo, Jan Niehues, Sebastian Stüker, Luisa Bentivogli, and Marcello Federico. 2014.  Report on the 11th iwslt evaluation campaign, iwslt 2014.  In _Proceedings of the International Workshop on Spoken Language Translation, Hanoi, Vietnam_ , volume 57.
  * Chen et al. (2018) Mia Xu Chen, Orhan Firat, Ankur Bapna, Melvin Johnson, Wolfgang Macherey, George F. Foster, Llion Jones, Niki Parmar, Mike Schuster, Zhifeng Chen, Yonghui Wu, and Macduff Hughes. 2018.  The best of both worlds: Combining recent advances in neural machine translation.  _CoRR_ , abs/1804.09849.
  * Cho et al. (2014) Kyunghyun Cho, Bart van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014.  Learning phrase representations using RNN encoder–decoder for statistical machine translation.  In _Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 1724–1734, Doha, Qatar. Association for Computational Linguistics.
  * Ciosek et al. (2020) Kamil Ciosek, Vincent Fortuin, Ryota Tomioka, Katja Hofmann, and Richard Turner. 2020.  Conservative uncertainty estimation by fitting prior networks.  In _International Conference on Learning Representations_.
  * Devlin et al. (2019) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019.  BERT: Pre-training of deep bidirectional transformers for language understanding.  In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_ , pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.
  * Geirhos et al. (2020) Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. 2020.  Shortcut learning in deep neural networks.  _arXiv preprint arXiv:2004.07780_.
  * Gerstenberger et al. (2020) Alexander Gerstenberger, Kazuki Irie, Pavel Golik, Eugen Beck, and Hermann Ney. 2020\.  Domain robust, fast, and compact neural language models.  In _ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)_ , pages 7954–7958.
  * Gulcehre et al. (2015) Caglar Gulcehre, Orhan Firat, Kelvin Xu, Kyunghyun Cho, Loic Barrault, Huei-Chi Lin, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2015.  On Using Monolingual Corpora in Neural Machine Translation.  _arXiv e-prints_ , page arXiv:1503.03535.
  * He et al. (2016) K. He, X. Zhang, S. Ren, and J. Sun. 2016.  Deep residual learning for image recognition.  In _2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)_ , pages 770–778.
  * Hupkes et al. (2019) Dieuwke Hupkes, Verna Dankers, Mathijs Mul, and Elia Bruni. 2019.  The compositionality of neural networks: integrating symbolism and connectionism.  _CoRR_ , abs/1908.08351.
  * Jaeger (2001) Herbert Jaeger. 2001.  The “echo state” approach to analysing and training recurrent neural networks-with an erratum note.  _Bonn, Germany: German National Research Center for Information Technology GMD Technical Report_ , 148(34):13.
  * Kingma and Ba (2015) Diederik P. Kingma and Jimmy Ba. 2015.  Adam: A method for stochastic optimization.  In _3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings_.
  * Krueger et al. (2020) David Krueger, Ethan Caballero, Jörn-Henrik Jacobsen, Amy Zhang, Jonathan Binas, Rémi Le Priol, and Aaron C. Courville. 2020.  Out-of-distribution generalization via risk extrapolation (rex).  _CoRR_ , abs/2003.00688.
  * Lapuschkin et al. (2019) Sebastian Lapuschkin, Stephan Wäldchen, Alexander Binder, Grégoire Montavon, Wojciech Samek, and Klaus-Robert Müller. 2019.  Unmasking clever hans predictors and assessing what machines really learn.  _CoRR_ , abs/1902.10178.
  * Levy et al. (2018) Omer Levy, Kenton Lee, Nicholas FitzGerald, and Luke Zettlemoyer. 2018.  Long short-term memory as a dynamically computed element-wise weighted sum.  In _Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)_ , pages 732–739, Melbourne, Australia. Association for Computational Linguistics.
  * Li et al. (2019) Xian Li, Paul Michel, Antonios Anastasopoulos, Yonatan Belinkov, Nadir Durrani, Orhan Firat, Philipp Koehn, Graham Neubig, Juan Pino, and Hassan Sajjad. 2019\.  Findings of the first shared task on machine translation robustness.  In _Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1)_ , pages 91–102, Florence, Italy. Association for Computational Linguistics.
  * Liu et al. (2020) Qian Liu, Shengnan An, Jian-Guang Lou, Bei Chen, Zeqi Lin, Yan Gao, Bin Zhou, Nanning Zheng, and Dongmei Zhang. 2020.  Compositional generalization by learning analytical expressions.  _arXiv preprint arXiv:2006.10627_.
  * Luong et al. (2015) Thang Luong, Hieu Pham, and Christopher D. Manning. 2015.  Effective approaches to attention-based neural machine translation.  In _Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing_ , pages 1412–1421, Lisbon, Portugal. Association for Computational Linguistics.
  * Maas et al. (2013) Andrew L. Maas, Awni Y. Hannun, and Andrew Y. Ng. 2013.  Rectifier nonlinearities improve neural network acoustic models.  In _in ICML Workshop on Deep Learning for Audio, Speech and Language Processing_.
  * Michel and Neubig (2018) Paul Michel and Graham Neubig. 2018.  Mtnt: A testbed for machine translation of noisy text.  In _Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing_.
  * Mikolov et al. (2010) Tomáš Mikolov, Martin Karafiát, Lukáš Burget, Jan Černockỳ, and Sanjeev Khudanpur. 2010.  Recurrent neural network based language model.  In _Eleventh annual conference of the international speech communication association_.
  * Müller et al. (2020) Mathias Müller, Annette Rios, and Rico Sennrich. 2020.  Domain robustness in neural machine translation.  In _Proceedings of the 14th Conference of the Association for Machine Translation in the Americas (Volume 1: Research Track)_ , pages 151–164, Virtual. Association for Machine Translation in the Americas.
  * Oren et al. (2019) Yonatan Oren, Shiori Sagawa, Tatsunori B. Hashimoto, and Percy Liang. 2019.  Distributionally robust language modeling.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 4227–4237, Hong Kong, China. Association for Computational Linguistics.
  * Ott et al. (2019) Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. 2019.  fairseq: A fast, extensible toolkit for sequence modeling.  In _Proceedings of NAACL-HLT 2019: Demonstrations_.
  * Pascanu et al. (2013) Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. 2013.  On the difficulty of training recurrent neural networks.  In _Proceedings of the 30th International Conference on International Conference on Machine Learning - Volume 28_ , ICML’13, page III–1310–III–1318. JMLR.org.
  * Recht et al. (2019) Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. 2019.  Do imagenet classifiers generalize to imagenet? _CoRR_ , abs/1902.10811.
  * Sabour et al. (2017) Sara Sabour, Nicholas Frosst, and Geoffrey E. Hinton. 2017.  Dynamic routing between capsules.  In _Proceedings of the 31st International Conference on Neural Information Processing Systems_ , NIPS’17, page 3859–3869, Red Hook, NY, USA. Curran Associates Inc.
  * Schölkopf et al. (2021) Bernhard Schölkopf, Francesco Locatello, Stefan Bauer, Nan Rosemary Ke, Nal Kalchbrenner, Anirudh Goyal, and Yoshua Bengio. 2021.  Toward causal representation learning.  _Proceedings of the IEEE_ , 109(5):612–634.
  * Sennrich et al. (2016) Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016.  Neural machine translation of rare words with subword units.  In _Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 1715–1725, Berlin, Germany. Association for Computational Linguistics.
  * Soulos et al. (2019) Paul Soulos, Tom McCoy, Tal Linzen, and Paul Smolensky. 2019.  Discovering the compositional structure of vector representations with role learning networks.  _CoRR_ , abs/1910.09113.
  * Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. 2017.  Attention is all you need.  In _Advances in Neural Information Processing Systems_ , volume 30, pages 5998–6008. Curran Associates, Inc.
  * Yang et al. (2018) Zhilin Yang, Zihang Dai, Ruslan Salakhutdinov, and William W. Cohen. 2018.  Breaking the softmax bottleneck: A high-rank RNN language model.  In _International Conference on Learning Representations_.
  * Zhang and Sennrich (2019) Biao Zhang and Rico Sennrich. 2019.  A lightweight recurrent network for sequence modeling.  In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_ , pages 1538–1548, Florence, Italy. Association for Computational Linguistics.
  * Zhang et al. (2018) Biao Zhang, Deyi Xiong, and Jinsong Su. 2018.  Accelerating neural transformer via an average attention network.  In _Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 1789–1798, Melbourne, Australia. Association for Computational Linguistics.

##  Appendix A Sequence-to-sequence experiments

We performed additional experiments on sequence-to-sequence (seq2seq) tasks.
We obtained negative results, which we report here.

### Architecture

Our models use a Transformer-GRU architecture. The encoder is a standard
bidirectional Transformer while the decoder is a two-layer stacked GRU (sec.
2). The recurrent cell also accesses contextual embeddings of a source
sentence tokens via an attention mechanism implemented as in Luong et al.
(2015), except that instead of a single attention head we use a Transformer
multihead attention layer, similar to Chen et al. (2018). The RND OOD model
has the same architecture as in the LM experiments, although for simplicity we
train it jointly with the MT models rather than in a separate stage, we make
sure not to propagate gradients between the RND OOD model and the translation
model hence there is no tradeoff between their training objectives. The
implementation is based on the Fairseq (Ott et al., 2019) Transformer and LSTM
architectures, using the hyperparameters for their default IWSLT14
configuration.

### Machine translation

We trained De$\rightarrow$En translation models on the IWSLT14 training set
(Cettolo et al., 2014) with the standard Fairseq preprocessing
pipeline555prepare-iwslt14.sh. We used on the standard test set produced by
the preprocessing script as our in-domain test set and the Müller et al.
(2020) test sets as our OOD test sets. We report BLEU scores in table 4. The
baseline and the RND model have nearly identical scores on the in-domain test
set, while they deviate up to about $1$ BLEU point on the OOD test sets,
although in a non-systematic way.

| in-domain | Müller et al. (2020)
---|---|---
| IWSLT14 | IT | Koran | Law | Med | Sub
Base | 32.95 | 11.03 | 5.72 | 11.35 | 13.76 | 19.19
RND | 32.97 | 12.07 | 5.13 | 12.02 | 13.93 | 18.71
Table 4: Machine translation results

### Sentence reversal

We considered a synthetic task intended to elicit the RND OOD activity. The
source segments consist each of a number of concatenated sentences separated
by a separator token, the target segments are made of the same sentences,
where each sentence is reversed at token level, but the sentences are
concatenated in the same order as the source. Since reversing a sentence does
not depend on the previous sentences in the segment, the previous sentences
become distractors that pollute the decoder GRU state with irrelevant
information. The model can learn to compensate in in-domain conditions where
the test set is sampled from the same distribution of the training set, but we
hypothesize that in OOD scenarios with longer segments composed by a higher
number of sentences this spurious information will greatly decrease accuracy.
We test whether the RND OOD mechanism is effective at discarding this spurious
information.

We consider two versions of the task, in one we sample the source segments
from a synthetic vocabulary of $256$ tokens, with uniform probability per
token, $32$ tokens per sentence, $8$ sentences per training segment. We test
in-domain at $8$ sentences and OOD at $10$ and $12$ sentences per segment. In
the second version, we train on concatenations of $4$ consecutive sentences of
the English side of the IWSLT14 De-En training set, and we test at $4,6,8,10$
and $12$ sentences per segment. We use the same hyperparameters of our
translation experiments, during inference we constrain the decoder to match
the source length.

All the models achieve near perfect ($>99.9$) BLEU scores in-domain, while OOD
the scores quickly decrease as the number of sentences per segment increases,
as expected. Unfortunately we find no systematic difference between baseline
and RND OOD models.

### Discussion

Unlike our language modeling experiments, we did not observe systematic
improvements from using the RND out-of-distribution detector to contract the
state of the GRU decoder in our sequence-to-sequence results. There are
multiple possible hypotheses for this discrepancy, such as encoder effects,
generating outputs by beam search rather than scoring natural text, or the
target distribution being more peaked around the mode. We plan to investigate
this effect in the future.


# Observational Causal Inference in Novel Diseases: A Case Study of COVID-19

Alexander Peysakhovich
Meta AI Research &Yin Aphinyanaphongs
NYU Langone

###### Abstract

A key issue for all observational causal inference is that it relies on an
unverifiable assumption - that observed characteristics are sufficient to
proxy for treatment confounding. In this paper we argue that in medical cases
these conditions are more likely to be met in cases where standardized
treatment guidelines do not yet exist. One example of such a situation is the
emergence of a novel disease. We study the case of early COVID-19 in New York
City hospitals and show that observational analysis of two important
thereapeutics, anti-coagulation and steroid therapy, gives results that agree
with later guidelines issued via combinations of randomized trials and other
evidence. We also argue that observational causal inference cannot be applied
mechanically and requires domain expertise by the analyst by showing a
cautionary tale of a treatment that appears extremely promising in the data,
but the result is due to a quirk of hospital policy.

##  1 Introduction

Evaluating the effectiveness of therapies is a primary problem in medicine.
The gold standard is the use of randomized trials (Concato et al., 2000).
However, randomized trials can be expensive and time-consuming. A second form
of evidence is the use of non-randomized data (e.g. data obtained during
normal hospital operation) to perform observational causal inference.

The biggest issue with observational causal inference is that patient
treatment assignment is not randomized - in particular that treatment
assignment and outcome are correlated aka. confounded (Angrist and Pischke,
2008; Imbens and Rubin, 2015). Thus, unlike in a randomized trial, a positive
(or negative) difference between treated and control groups does not
necessarily mean that the treatment causes this difference.

A large set of observational causal inference methods (e.g. propensity score
based methods (Rosenbaum and Rubin, 1983), model adjustment based methods (Van
der Laan and Rose, 2011), or doubly robust methods (Bang and Robins, 2005))
attempt to deal with the issue by removing the confounding using observed
characteristics of the patients. In essence this creates a synthetic treatment
and control group where now treatment is ‘as good as random.’

The key assumption behind all of these methods is that observed
characteristics are sufficient to proxy for the confounding (Imbens and Rubin,
2015). However, this assumption is by definition unverifiable and so in
general the credibility of an effect derived by observational causal inference
comes down to whether the “deconfounding” is likely to be sufficient (or not).

In medicine some conditions have well entrenched treatment plans. In this
case, we either explicitly lack the ability to match treated patients to a
‘similar’ control. This is because when a patient that meets criteria for
treatment is not treated it is for a specific reason that makes that patient
‘special’ (perhaps for unobservable reasons) and thus not necessarily a good
match for a treated patient.

By contrast, sometimes we do not have well entrenched treatment plans. For
example, in the case of novel diseases where information changes day to day,
doctors have little experience with the disease, and different doctors may
choose to take different actions for similar patients. In this case we argue
that observational causal inference can be extremely useful as there will be
considerable overlap between treated and control distributions.

We study the case of the early COVID-19 outbreak in New York City. During this
phase there were two major causes of patient degradation - thrombotic events
(clotting) (Cantador et al., 2020) and inflammation (Shang et al., 2020). We
use observational causal inference to look at the effectiveness of two
therapies - aggressive anti-coagulation and the use of steroids. We show that
general use of therapeutic anti-coagulation (relative to prophylactic) appears
not to have obvious benefits. By contrast, we show that steroid therapy does
have positive effects. This is precisely the guidance that emerged over the
next year of COVID-19 treatment due to randomized trials (RECOVERYGroup, 2021;
Sadeghipour et al., 2021; REMAP-CAP and Investigators, 2021).

There is no statistical test for whether the de-confounding assumption holds
(Angrist and Pischke, 2008). Thus observational causal inference requires
analysts to get their hands dirty with understanding the data generating
process. We show a cautionary tale - an example of a therapy, factor XA
inhibitors, where patients who receive it appear to have better outcomes, even
after adjusting for other observed factors. However, this positive association
is unlikely to be causal - rather, patients who are deemed well enough to be
discharged from the hospital were often given a factor XA inhibitor
prescription and started on the treatment in their last few days.

Taken together, we argue that observational causal inference can be especially
useful in the context of novel diseases where a lack of treatment protocols
creates the necessary overlap in treated/control distributions. While
observational results are not guaranteed to be causal without additional
assumptions, knowledge of the data generating mechanism by the analyst can
make these assumptions more plausible. Observational causal inference results
should be used as complements to physician knowledge to help come up with
treatment plans as well as generating potential hypotheses to be verified in
more expensive randomized trials.

##  2 Dataset

We use a de-identified dataset of patients admitted to a New York area
hospital system for COVID19 between March and May of 2020.

For all of the patients we construct a set of covariates including
demographics (age, sex, race/ethnicity, smoking status), known comorbidities
(prior myocardial infarction, heart failure, vascular disease, dementia,
pulmonary disease, rheumatoid disease, peptic ulcer disease, diabetes, cancer,
liver disease, HIV/AIDS, and the compound Charlson Score), out-patient
medications (whether the patient was taking analgesics, antihistamines,
antiarthritics, antifungals, antibiotics, antiparasitics, anticoagulants,
antihyperglycemics, tumor necrosis inhibiting agents, antineoplastics,
antiparkison drugs, antiplatelet drugs, antivirals, cardiovascular drugs,
contraceptives, cough preparations, CNS drugs, autonomic drugs, diuretics,
gastrointestinal drugs, hormones, immunosuppressants, muscle relaxants, pre-
natal vitamins, psychotherapeuric drugs, sedatives, smoking deterrents,
thyroid drugs, or vitains), as well as the first lab taken within the first 36
hours of hospital stay (we use 36 hours as we have access to lab result times
rather than lab order times, see below for more description of labs used), and
summary statistics (mean, min, max) of vital signs (heart rate, oxygen
saturation, blood pressure, temperature, respiratory rate) from the first 24
hours of hospital stay.

###  2.1 Lab Values

Not all patients have all lab values. To deal with this we first drop all labs
with more than $20\%$ missing values. As an exception to rule we keep D-dimer
(a measure of coagulation) as a covariate in our anti-coagulation analyses. It
is missing for $25\%$ of patients, but we have prior knowledge that is used by
clinicians in treatment assignment for anti-coagulation.

Many of these labs are extremely right skewed, so we use a log transformation
to normalize them. In addition, we see some examples of values outside of
biological plausibility due to data quality issues. To deal with these we
perform a winsorization at the 99th percentile for each lab.

The final list of labs that we use are: Albumin, Alkaline Phosphate, ALT, AST,
Bilirubin, Blood Urea Nitrogen, C-Reactive Protein, Calcium, Chloride,
Creatinine, D-Dimer, Eosonophils, Ferritin, Hematocrit, LDH, Lymphocytes,
Platelet Volume, Monocytes, Neutrophils, Potassium, Protein, Prothrombin Time,
Sodium, WBC.

###  2.2 Outcome Measure Construction

As our primary outcome of interest we use 21 organ support free days (21OSFD).
We chose this measure after consulting with physicians working in our hospital
as this measure is employed in existing randomized trials (e.g. ) or
(Abdelhady et al., 2021).

The 21 organ support free days measure is the number of days that a patient
does not require pressors, renal replacement therapy, hi flow oxygen, or
invasive mechanical ventilation. Patients that die during the course of their
stay receive a $-1$ for the measure.

We look at patients that are admitted at least 21 days before the end of our
observation period, thus we do not have censoring in our data.

##  3 Treatments Studied

We study two treatments: aggressive anti-coagulation therapy and steroids. We
describe the medical details of each treatment that guide some of our analysis
choices below.

###  3.1 Anticoagulation

A major driver of adverse outcomes in COVID-19 patients is thrombosis
(Bilaloglu et al., 2020). The standard protocol for dealing with clotting is
the use of anti-coagulation (AC). AC is typically broken down into two doses -
a smaller or prophylactic dose which is used to prevent clots from forming and
a larger or therapeutic dose which is typically given when a clot is already
detected (Lloyd et al., 2008).

At the time this data was collected, there was major debate about whether the
prevalence of thrombotic events in COVID patients should lead to a more
aggressive AC strategy. Here we evaluate the use of such an aggressive
strategy. Note that almost all patients at our hospital receive some form of
anticoagulation therapy during their stay - $92\%$ patients in our data
receive some AC with median time to first AC dose of $8$ hours, so we are not
evaluating a “no AC” arm.

We focus on two possible strategies: aggressive early AC versus a more
conservative strategy of beginning with prophylactic and moving to a larger
dose later if it is needed. We define our treatment as individuals either
receive therapeutic levels (treatment) or only prophylactic (control) levels
of AC for their first $72$ hours in the hospital. We remove individuals who
receive more than one level of AC during this period.111The 72 hour window was
chosen after consultation with physicians. Varying the window to be 24, 48,
72, or 96 hours does not change the main results. The tradeoff is that using a
larger window decreases our sample size since we remove patients that receive
multiple levels of AC during the window of study.

The definition of therapeutic AC includes all intravenous Heparin, Rivaroxban,
Warfarin, Dabigatran, or high dose ($\geq$60mg) Enoxaparin.
Preventative/prophylatic AC includes subcutaneous heparin with $\leq$ 15,000
units per 24 hours, or low dose (less than 60mg) Enoxaparin. The vast majority
of AC treatment in our sample is Heparin.

From speaking to clinicians, we know that D-dimer was used as an indicator of
possible severe clotting during this time. We see in our data that almost all
patients with extremely high (¿3000 ng/mL) D-dimer levels receive aggressive
AC. For this reason, we restrict our analysis to patients with D-dimer levels
below $3000$.

Overall $23\%$ of our sample receives the aggressive treatment. Figure 1 below
shows the observed probability of aggressive treatment by baseline D-dimer as
well as distribution of D-dimer by treatment group. We see that there is
substantial overlap in the ‘elevated’ category which also makes up the
majority of our patients.

(a) D-dimer Predicts Treatment

(b) D-dimer Distribution By Treatment

Figure 1: Higher D-dimer patients were much more likely to receive aggressive
AC as we would expect (panel a). We see that there is substantial overlap in
D-dimer across treatments when extremely high levels ($\geq 3000$) are
removed.

###  3.2 Steroid Therapy

A second major driver of adverse outcomes for COVID-19 patients is is
inflammation-mediated lung injury. A treatment for inflammation is the use of
glucocorticoids (steroids). In our analysis patient is deemed to be receiving
steroid treatment if they receive steroids (Dexamethasone, Hydrocortisone, or
Prednisone) within their first 72 hours of hospital admission.

Here our complete cases analysis includes $2282$ patients with $190$
(approximately $8\%$) of them receiving the steroid treatment. Unlike in the
AC analysis we do not have exclusion criteria based on lab results as we did
not learn of any single lab that was used by all clinicians. Rather,
combinations of factors led some (but not others) to treat using steroids.

The prevailing consensus at the time of the COVID19 outbreak in New York City
was mixed (Shang et al., 2020; Russell et al., 2020) with randomized trials
(RECOVERYGroup, 2021) only available much later. Though after randomized
trials the use of steroids became common, in our sample, however, we see that
only $\sim 8\%$ of our patients receive steroids in their first 72 hours of
hospital stay.

##  4 Results

For both treatment we look at 3 analyses: first, the overall (unadjusted)
correlation between treatment and outcome. Second, we adjust for our observed
covariates in a linear regression and report the coefficient on treatment.
Third, we perform propensity score matching.

To do the propensity score matching we use a logistic regression on the full
set of covariates to construct the propensity scores. Because most units are
not treated, we matched 3 control units per 1 treated unit with a caliper of
size $.05$. All analyses were done using the R package Matching (Sekhon,
2008).

We estimate the average treatment effect on the treated (ATT) in our
propensity score match. Recent work as shown that regression in observational
data estimates something close to the ATT (Słoczyński, 2020) when the
proportion of treated individuals is small (as in both our cases), so this
makes our estimates comparable.

###  4.1 Overlap Analysis

We investigate the quality of our matching analysis by looking at overlaps in
propensity scores as well as pre-and-post match balance on the covariates.
Because we have a large number of covariates, we show only ‘important’ ones in
the balance plot. We select these important covariates by running two cross-
validated L1 regularized regressions using the $R$ package $glmnet$ (Hastie et
al., 2016) predict the outcome and the treatment. We then take the union of
the set of covariates selected by these models (note that in theory only
variables which affect both the outcome and the treatment are actually
confounders so this is a very conservative selection).

Figure 2 shows the propensity score distributions for both treatments. We see
that there are some unmatchable samples (examination of our data shows that
these examples appear to be very sick patients that receive aggressive
treatment). However, there is a large overlap in distributions which allows
for matching. We drop $84$ (approximately $33\%$) treated patients in our
matching for AC analysis and $44$ ($\sim 23\%$) treated patients in our
steroid analysis.

(a) Agressive AC

(b) Steroid Use

Figure 2: Propensity score distributions from our dataset. We are able to
match $66\%$ of aggressive AC treated patients and $77\%$ of steroid treated
patients when using a caliper of size $.05.$

Figure 3 shows balance plots222We used the $R$ package cobalt
(https://cran.r-project.org/web/packages/cobalt/index.html) to generate these
plots. for both treatments for the ‘important’ variables as defined above. We
see that the propensity matching produces relatively comparable distributions
in terms of means in both treatments.

(a) Agressive AC

(b) Steroid Use

Figure 3: Balance plots for our analyses. Propensity scores are trained with
all labs and vital signs, to save space the balance plots only show important
features as selected by Lasso linear models trained to predict treatment and
outcome. Features starting with $v24$ are vital signals with BP representing
blood pressure, HR representing heart rate. Features with $l36$ are lab
values. Features starting with $cm$ are comorbidities. Features starting with
$meds$ are outpatient medications.

###  4.2 Causal Effect Estimates

Finally, we show our causal effect estimates in Figure 4. We see that without
balance/adjustment that there is a baseline negative association between both
treatments and outcome. Thus, baseline sicker patients are more likely to
receive both treatments.

However, after adjustment or matching we see that there is now a positive
association between steroid treatment and outcome (regression point estimate
$1.34$ and $95\%$ CI = $[.11,.257]$ $p<.05$, matching point estimate $1.36$
and $95\%$ CI = $[-.13,2.85]$ $p=.07$). By contrast we see little effect of
more aggressive AC therapy with point estimates near $0$ (regression point
estimate $-.55$ with $95\%$ CI = $[-1.82,.75]$, matching point estimate $-.27$
with $95\%$ CI = $[-1.8.8]$).

Figure 4: In both AC and steroid treatments sicker patients are more likely to
receive the treatment. However, after adjustment or matching we see that there
is no strong association between AC treatment and outcome and a positive
association between steroid treatment and outcome. Error bars indicate $95\%$
confidence intervals.

###  4.3 External Validation

Our observational results, derived from data in the early months of the
pandemic, are consistent with treatment policies which evolved over the course
of the pandemic
www.covid19treatmentguidelines.nih.gov/therapies/antithrombotic-therapy/) as
well as by randomized trial data showing no beneficial effect of starting
aggressive therapeutic level AC compared to standard care (Sadeghipour et al.,
2021). Other observational studies hint at heterogeneous effects (Paranjpe et
al., 2020). We lack the statistical power to look for anything other than a
main effect in our population (recall the rule of thumb that testing a single
heterogeneous cut requires about $16\times$ the data compared to testing a
main effect (Gelman, 2018)).

By contrast, steroids (in particular, Dexamethasone) have been shown to be
effective at reducing adverse events in COVID patients in randomized trials
(RECOVERYGroup, 2021) with other observational work looking for heterogeneous
effects (Lengerich et al., 2021). Steroid therapy is a standard tool in
practitioners treating COVID patients
https://www.covid19treatmentguidelines.nih.gov/management/clinical-
management/hospitalized-adults--therapeutic-management/).

##  5 Conclusion and Caution

While the prior sections may seem to suggest that observational causal
inference is relatively straightforward in cases where treatment plans are not
set in stone, this is quite far from the truth. Here we will argue that causal
inference is not simply a statistical exercise, but one which requires
knowledge about the underlying data generating process from the analyst.

We consider another class of anti-coagulant drugs, factor XA inhibitors (FXI).
These drugs are different from the mostly Heparin based AC that we considered
earlier in two ways: first, they affect a different part of the clotting
pathway than Heparin (Ansell, 2007), second they are available in oral form
while most of the AC we considered before is either subcutaenous or
intravenously administered.

We consider a naive definition of treatment where we define a patient as
treated $(N_{treated}=318)$ if they received any factor XA inhibitors during
their time in the hospital $(N_{control}=1963)$.

We perform the same analyses (linear model with adjusting, propensity score
matching) as in the main analysis. Figure 5 shows the balance plots (as above
we show only ‘important’ variables selected via Lasso regressions) as well as
the the effect estimates.

(a) Propensity Score Balance

(b) Factor XA Analysis Results

Figure 5: Model results appear to show that Factor XA has a large (the size of
steroids) protective affect on patients. However, this is likely an artifact
of the data generating process - we know that at the time these data were
collected patients who were to be discharged from the hospital were prescribed
Factor XA inhibitors as out-patient treatment and started on them before the
discharge occurred.

The model results appear to show that FXI has a large (the size of steroids)
protective affect on patients. However, this is likely an artifact of the data
generating process - we know that at the time these data were collected
patients who were to be discharged from the hospital were prescribed Factor XA
inhibitors as out-patient treatment and started on them before the discharge
occurred. Note that a part of our erroneous conclusion comes from the way we
define the treatment variable - by looking at individuals who ever receive
treatment rather than individuals who receive the treatment early in their
stay (as in the AC/steroids analyses).

We do note that there appear to be some hints in the results that something is
off. First, we see that the baseline correlation between treatment and outcome
is weakly positive. This means that in general we do not see the relationship
that we see in steroid/AC treatments where more sick patients are more likely
to get the treatment. While there are plausibly reasons for this, it does
signal us to be somewhat cautious. Second, we see that even after matching we
have an imbalance in the important covariates. This further suggests that very
different individuals are receiving treatment and control.

The key point remains that while observational causal inference can be a
useful tool in medicine especially during times when treatment guidelines are
not set in strong. In both the AC and steroid treatments we cleanly recover
results that are confirmed by randomized control trials. However, gaining
knowledge from observational studies requires carefully defining treatment
variables and understanding the data generating process as our factor XA
example shows.

## References

  * (1)
  * Abdelhady et al. (2021) Hesham Abdelhady, Marwa Abdelrazik, Zakee Abdi, David Abdo, Amina Abdulle, Lynn Abel, Shrefee Abouzeenni, Gail Abrahamson, Yousuf Abusamra, Lisa Adams, et al. 2021\.  Effect of Convalescent Plasma on Organ Support–Free Days in Critically Ill Patients With COVID-19: A Randomized Clinical Trial.  _Jama_ 326, 17 (2021), 1690–1702.
  * Angrist and Pischke (2008) Joshua D Angrist and Jörn-Steffen Pischke. 2008.  _Mostly harmless econometrics_.  Princeton university press.
  * Ansell (2007) J Ansell. 2007.  Factor Xa or thrombin: is factor Xa a better target?  _Journal of Thrombosis and Haemostasis_ 5 (2007), 60–64.
  * Bang and Robins (2005) Heejung Bang and James M Robins. 2005.  Doubly robust estimation in missing data and causal inference models.  _Biometrics_ 61, 4 (2005), 962–973.
  * Bilaloglu et al. (2020) Seda Bilaloglu, Yin Aphinyanaphongs, Simon Jones, Eduardo Iturrate, Judith Hochman, and Jeffrey S Berger. 2020.  Thrombosis in hospitalized patients with COVID-19 in a New York City health system.  _Jama_ 324, 8 (2020), 799–801.
  * Cantador et al. (2020) Estefanía Cantador, Alberto Núñez, Pilar Sobrino, Victoria Espejo, Lucía Fabia, Lydia Vela, Luis de Benito, and Javier Botas. 2020.  Incidence and consequences of systemic arterial thrombotic events in COVID-19 patients.  _Journal of thrombosis and thrombolysis_ 50 (2020), 543–547.
  * Concato et al. (2000) John Concato, Nirav Shah, and Ralph I Horwitz. 2000.  Randomized, controlled trials, observational studies, and the hierarchy of research designs.  _New England journal of medicine_ 342, 25 (2000), 1887–1892.
  * Gelman (2018) Andrew Gelman. 2018\.  You need 16 times the sample size to estimate an interaction than to estimate a main effect.  https://statmodeling.stat.columbia.edu/2018/03/15/need-16-times-sample-size-estimate-interaction-estimate-main-effect/
  * Hastie et al. (2016) Trevor Hastie, Junyang Qian, and Kenneth Tay. 2016.  An Introduction to glmnet.
  * Imbens and Rubin (2015) Guido W Imbens and Donald B Rubin. 2015.  _Causal inference in statistics, social, and biomedical sciences_.  Cambridge University Press.
  * Lengerich et al. (2021) Benjamin J Lengerich, Rich Caruana, Alex Peysakhovich, Leora Horwitz, and Yin Aphinyanaphongs. 2021\.  Neutrophil Lymphocyte Ratio as a Predictor of Glucocorticoid Effectiveness in Covid-19 Treatment.  _medRxiv_ (2021).
  * Lloyd et al. (2008) NS Lloyd, JD Douketis, I Moinuddin, W Lim, and MA Crowther. 2008.  Anticoagulant prophylaxis to prevent asymptomatic deep vein thrombosis in hospitalized medical patients: a systematic review and meta-analysis.  _Journal of Thrombosis and Haemostasis_ 6, 3 (2008), 405–414.
  * Paranjpe et al. (2020) Ishan Paranjpe, Valentin Fuster, Anuradha Lala, Adam J Russak, Benjamin S Glicksberg, Matthew A Levin, Alexander W Charney, Jagat Narula, Zahi A Fayad, Emilia Bagiella, et al. 2020\.  Association of treatment dose anticoagulation with in-hospital survival among hospitalized patients with COVID-19.  _Journal of the American College of Cardiology_ 76, 1 (2020), 122–124.
  * RECOVERYGroup (2021) RECOVERYGroup. 2021\.  Dexamethasone in hospitalized patients with Covid-19.  _New England Journal of Medicine_ 384, 8 (2021), 693–704.
  * REMAP-CAP and Investigators (2021) ACTIV-4a REMAP-CAP and ATTACC Investigators. 2021.  Therapeutic anticoagulation with heparin in critically ill patients with COVID-19.  _New England Journal of Medicine_ 385, 9 (2021), 777–789.
  * Rosenbaum and Rubin (1983) Paul R Rosenbaum and Donald B Rubin. 1983.  The central role of the propensity score in observational studies for causal effects.  _Biometrika_ 70, 1 (1983), 41–55.
  * Russell et al. (2020) Clark D Russell, Jonathan E Millar, and J Kenneth Baillie. 2020.  Clinical evidence does not support corticosteroid treatment for 2019-nCoV lung injury.  _The Lancet_ 395, 10223 (2020), 473–475.
  * Sadeghipour et al. (2021) Parham Sadeghipour, Azita H Talasaz, Farid Rashidi, Babak Sharif-Kashani, Mohammad Taghi Beigmohammadi, Mohsen Farrokhpour, Seyed Hashem Sezavar, Pooya Payandemehr, Ali Dabbagh, Keivan Gohari Moghadam, et al. 2021\.  Effect of intermediate-dose vs standard-dose prophylactic anticoagulation on thrombotic events, extracorporeal membrane oxygenation treatment, or mortality among patients with COVID-19 admitted to the intensive care unit: the INSPIRATION randomized clinical trial.  _Jama_ 325, 16 (2021), 1620–1630.
  * Sekhon (2008) Jasjeet S Sekhon. 2008\.  Multivariate and propensity score matching software with automated balance optimization: the matching package for R.  _Journal of Statistical Software, Forthcoming_ (2008).
  * Shang et al. (2020) Lianhan Shang, Jianping Zhao, Yi Hu, Ronghui Du, and Bin Cao. 2020.  On the use of corticosteroids for 2019-nCoV pneumonia.  _The Lancet_ 395, 10225 (2020), 683–684.
  * Słoczyński (2020) Tymon Słoczyński. 2020\.  Interpreting ols estimands when treatment effects are heterogeneous: Smaller groups get larger weights.  _The Review of Economics and Statistics_ (2020), 1–27.
  * Van der Laan and Rose (2011) Mark J Van der Laan and Sherri Rose. 2011.  _Targeted learning: causal inference for observational and experimental data_.  Springer Science & Business Media.