<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/change-over-time-is-not-treatment-response/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rpsychologist.com/treatment-response-subgroup"> R Psychologist - R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>This will be a non-technical post illustrating the problems with identifying treatment responders or non-responders using inappropriate within-group analyses. Specifically, I will show why it is pointless to try to identify a subgroup of non-responders using a naïve analysis of data from one treatment group only, even though we have weekly measures over time.</p>
<p>This type of unwarranted and misleading causal language is surprisingly common. You see this type of language even when the data comes from an RCT, often in secondary analyses of mediators, predictors, or in even trendier studies where the authors have a strong urge to mix <em>omics</em> (e.g., genomics) and artificial intelligence/machine learning for vague reasons. </p>
<h2>Defining treatment response</h2>
<p>When we talk about “treatment response” we usually mean the causal estimand, i.e., the counterfactual comparison of the effect of receiving the treatment versus not-receiving the treatment. Deep down we all know that a treatment outcome is a relative contrast, and not simply a patient’s change from pre to posttest. We can (usually) only estimate the effect of the treatment on the group level, by randomizing patients to a treatment or a control group and estimating the average treatment effect by comparing the expected outcome in the two groups. The rate at which we tend to “forget” this basic knowledge seems directly related to our drive to publish in high impact journals.</p>
<h2>Simulating the problem</h2>
<div>
<pre><span></span><span># Packages used</span>
<span>library</span><span>(</span>tidyverse<span>)</span>
<span>library</span><span>(</span>powerlmm<span>)</span> <span># dev version</span>
<span>library</span><span>(</span>ggrepel<span>)</span>
</pre>
</div>
<p>I will use <code>powerlmm</code> to simulate some longitudinal treatment data. In this setup, the control group has a ~40% reduction in symptoms at posttest, which in this case would give a Cohen’s <em>d</em> of 0.5. And the actual treatment effect is <em>d</em> = 0.5, i.e., a 7 point difference at posttest between the treatment and control group. These would not be surprising numbers in some psychiatric trials.</p>
<div>
<pre><span></span>p <span>&lt;-</span> study_parameters<span>(</span>design <span>=</span> study_design<span>(),</span>
                      n1 <span>=</span> <span>11</span><span>,</span>
                      n2 <span>=</span> <span>200</span><span>,</span>
                      fixed_intercept <span>=</span> <span>17</span><span>,</span>
                      fixed_slope <span>=</span> <span>-7</span><span>/</span><span>10</span><span>,</span>
                      icc_pre_subject <span>=</span> <span>0.5</span><span>,</span>
                      var_ratio <span>=</span> <span>0.03</span><span>,</span>
                      cor_subject <span>=</span> <span>-0.5</span><span>,</span>
                      effect_size <span>=</span> cohend<span>(</span><span>-0.5</span><span>)</span>
<span>)</span>
</pre>
</div>
<div>
<pre><span></span>plot<span>(</span>p<span>,</span> type <span>=</span> <span>&quot;trend&quot;</span><span>,</span> RE <span>=</span> <span>FALSE</span><span>)</span> <span>+</span>
  theme_minimal<span>()</span> <span>+</span>
   scale_color_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;Control&quot;</span> <span>=</span> <span>&quot;gray66&quot;</span><span>,</span> 
                                  <span>&quot;Treatment&quot;</span> <span>=</span> <span>&quot;#0984e3&quot;</span><span>))</span> 
</pre>
</div>
<p><img alt="center" title="center" src="https://i0.wp.com/rpsychologist.com/img/treatment-response-subgroup/treatment-response-subgroup-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<h3>Creating the subgroups</h3>
<p>We want to add a subgroup of “non-responders”, and we do this by simply assigning subjects to group A or B based on their latent random slopes. This is easily done using the <code>data_transform</code> argument. The non-responders have subject-specific slopes 1 SD above the mean. Obviously, this is a bit simplistic, but it gets the point across. </p>
<div>
<pre><span></span>add_subgroup <span>&lt;-</span> <span>function</span><span>(</span>d<span>)</span> <span>{</span>

  <span># 1.73 is the slope SD</span>
  d<span>$</span>subgroup <span>&lt;-</span> <span>ifelse</span><span>(</span>d<span>$</span>subject_slope <span></span> <span>1.73</span><span>,</span> <span>&quot;B&quot;</span><span>,</span> <span>&quot;A&quot;</span><span>)</span>
  d<span>$</span>subgroup <span>&lt;-</span> <span>factor</span><span>(</span>d<span>$</span>subgroup<span>)</span>

  d
<span>}</span>
</pre>
</div>
<p>If we plot one realization of the latent slopes from this data generating process, we get this figure.</p>
<p>

</p>
<div>
<div>
<pre><span></span><span>set.seed</span><span>(</span><span>1234</span><span>)</span>
p0 <span>&lt;-</span> p <span>%>%</span> 
  update<span>(</span>n2 <span>=</span> <span>1000</span><span>)</span> <span>%>%</span> 
  simulate_data <span>%>%</span> 
  add_subgroup<span>()</span> <span>%>%</span> 
  mutate<span>(</span>mu <span>=</span> fixed_intercept <span>+</span> subject_intercept <span>+</span> <span>(</span>fixed_slope <span>+</span> subject_slope<span>)</span> <span>*</span> time<span>)</span> <span>%>%</span>    
  ggplot<span>(</span>aes<span>(</span>time<span>,</span> mu<span>,</span> group <span>=</span> subject<span>))</span> <span>+</span> 
  geom_line<span>(</span>aes<span>(</span>color <span>=</span> subgroup<span>,</span> alpha <span>=</span> subgroup<span>))</span> <span>+</span> 
  geom_text_repel<span>(</span>data <span>=</span> <span>data.frame</span><span>(</span>mu <span>=</span> <span>25</span><span>,</span> time <span>=</span> <span>5</span><span>),</span>
                  aes<span>(</span>group <span>=</span> <span>NULL</span><span>),</span>
                  direction <span>=</span> <span>&quot;y&quot;</span><span>,</span>
                  ylim <span>=</span> <span>c</span><span>(</span><span>45</span><span>,</span><span>NA</span><span>),</span>
                  point.padding <span>=</span> <span>1</span><span>,</span>

                  arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>)),</span>
                  label.size <span>=</span> <span>NA</span><span>,</span> 
                  segment.color <span>=</span> <span>&quot;gray35&quot;</span><span>,</span>
                  label <span>=</span> <span>&quot;A subgroup with participants that\n tend to decline over time&quot;</span><span>)</span> <span>+</span>
  scale_color_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;B&quot;</span> <span>=</span> <span>&quot;gray66&quot;</span><span>,</span> 
                                <span>&quot;A&quot;</span> <span>=</span> <span>&quot;#0984e3&quot;</span><span>))</span> <span>+</span>
  scale_alpha_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;B&quot;</span> <span>=</span> <span>0.25</span><span>,</span> 
                                <span>&quot;A&quot;</span> <span>=</span> <span>0.75</span><span>))</span> <span>+</span>
  theme_minimal<span>()</span> <span>+</span>
  theme<span>(</span>legend.position <span>=</span> <span>&quot;bottom&quot;</span><span>)</span> <span>+</span>
  labs<span>(</span>title <span>=</span> <span>&quot;Treatment group&quot;</span><span>)</span>
</pre>
</div>
</div>
<p><img alt="center" title="center" src="https://i2.wp.com/rpsychologist.com/img/treatment-response-subgroup/unnamed-chunk-2-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<h3>A naïve analysis: Using only the treatment group</h3>
<p>Let’s say we have access to data from a clinic that carefully monitor their patients’ change during treatment (e.g., IAPT). The sample size is large, and we want to identify if there is a subgroup of patients that are “non-responders”. There is no control group, but we have weekly measures during the treatment (there is also perfect adherence and no dropout…), we also have access to some cool baseline marker data that will impress reviewers and enable “personalized treatment selection for non-responding patients”. So what we do is run an analysis to identify if there is an interaction between our proposed subgroup variable and change over time. Let’s run such a simulation.</p>
<div>
<pre><span></span>add_subgroup_tx_only <span>&lt;-</span> <span>function</span><span>(</span>d<span>)</span> <span>{</span>
  d<span>$</span>subgroup <span>&lt;-</span> <span>ifelse</span><span>(</span>d<span>$</span>subject_slope <span></span> <span>1.73</span><span>,</span> <span>&quot;B&quot;</span><span>,</span> <span>&quot;A&quot;</span><span>)</span>
  d<span>$</span>subgroup <span>&lt;-</span> <span>factor</span><span>(</span>d<span>$</span>subgroup<span>)</span>

  d <span>&lt;-</span> dplyr<span>::</span>filter<span>(</span>d<span>,</span> treatment <span>==</span> <span>1</span><span>)</span>
  d
<span>}</span>

f <span>&lt;-</span> sim_formula<span>(</span><span>&quot;y ~ subgroup * time + (1 + time | subject)&quot;</span><span>,</span> 
                 data_transform <span>=</span> add_subgroup_tx_only<span>,</span> 
                 test <span>=</span> <span>c</span><span>(</span><span>&quot;time&quot;</span><span>))</span>

res <span>&lt;-</span> simulate<span>(</span>p<span>,</span> 
                formula <span>=</span> f<span>,</span> 
                nsim <span>=</span> <span>5000</span><span>,</span> 
                cores <span>=</span> <span>16</span><span>)</span>
</pre>
</div>
<div>
<pre><span></span><span>summary</span><span>(</span>res<span>)</span>
</pre>
</div>
<div>
<pre><span></span>## Model:  default 
## 
## Random effects 
## 
##          parameter  M_est theta est_rel_bias prop_zero is_NA
##  subject_intercept  89.00 100.0        -0.11         0     0
##      subject_slope   1.70   3.0        -0.44         0     0
##              error 100.00 100.0         0.00         0     0
##        cor_subject  -0.39  -0.5        -0.22         0     0
## 
## Fixed effects 
## 
##       parameter M_est theta M_se SD_est Power Power_bw Power_satt
##     (Intercept)   9.3  17.0 2.00   1.90  1.00        .        NaN
##       subgroupB   9.1     . 2.10   2.10  0.99        .        NaN
##            time   1.2  -0.7 0.29   0.22  1.00        1        NaN
##  subgroupB:time  -3.1     . 0.31   0.25  1.00        .        NaN
## ---
## Number of simulations: 5000  | alpha:  0.05
## Time points (n1):  11
## Subjects per cluster (n2 x n3):  200 (treatment)
##                                  200 (control)
## Total number of subjects:  400 
## ---
## At least one of the models applied a data transformation during simulation,
## summaries that depend on the true parameter values will no longer be correct,
## see 'help(summary.plcp_sim)'
</pre>
</div>
<p>We see that we tend to identify a powerful subgroup effect, participants in the A subgroup tend to change less and even deteriorate during the treatment. Surely, this is substantial proof that there is a differential treatment response and that these patients did not respond to the treatment? I’m sure you know the answer, but to be sure let us also run the simulation were we have access to some similar data from another source that actually randomized their patients to receive either the treatment or a placebo control. What we want now is to identify an interaction between the subgroup variable and the treatment-by-time interaction. So we update the simulation formula.</p>
<div>
<pre><span></span>f2 <span>&lt;-</span> sim_formula<span>(</span><span>&quot;y ~ subgroup * time * treatment + (1 + time | subject)&quot;</span><span>,</span> 
                  data_transform <span>=</span> add_subgroup<span>)</span>

res2 <span>&lt;-</span> simulate<span>(</span>p<span>,</span> 
                 formula <span>=</span> f2<span>,</span> 
                 nsim <span>=</span> <span>5000</span><span>,</span> 
                 cores <span>=</span> <span>16</span><span>)</span>
</pre>
</div>
<div>
<pre><span></span><span>summary</span><span>(</span>res2<span>)</span>
</pre>
</div>
<div>
<pre><span></span>## Model:  default 
## 
## Random effects 
## 
##          parameter M_est theta est_rel_bias prop_zero is_NA
##  subject_intercept  89.0 100.0        -0.11         0     0
##      subject_slope   1.7   3.0        -0.44         0     0
##              error 100.0 100.0         0.00         0     0
##        cor_subject  -0.4  -0.5        -0.21         0     0
## 
## Fixed effects 
## 
##                 parameter M_est theta M_se SD_est Power Power_bw Power_satt
##               (Intercept)  9.40 17.00 2.00   1.90  1.00        .        NaN
##                 subgroupB  9.00     . 2.10   2.10  0.99        .        NaN
##                      time  1.90 -0.70 0.29   0.22  1.00        .        NaN
##                 treatment -0.01  0.00 2.80   2.70  0.04        .        NaN
##            subgroupB:time -3.10     . 0.31   0.26  1.00        .        NaN
##       subgroupB:treatment  0.02     . 3.00   3.00  0.04        .        NaN
##            time:treatment -0.71 -0.71 0.41   0.32  0.39     0.39        NaN
##  subgroupB:time:treatment  0.00     . 0.44   0.36  0.02        .        NaN
## ---
## Number of simulations: 5000  | alpha:  0.05
## Time points (n1):  11
## Subjects per cluster (n2 x n3):  200 (treatment)
##                                  200 (control)
## Total number of subjects:  400 
## ---
## At least one of the models applied a data transformation during simulation,
## summaries that depend on the true parameter values will no longer be correct,
## see 'help(summary.plcp_sim)'
</pre>
</div>
<p>Using the appropriate estimand of a subgroup effect we now get the “disappointing” result that there is absolutely no difference in treatment response for participants in subgroup A or B. The coefficient <code>subgroupB:time:treatment</code> is zero on average. To make it even more clear what is going on let us also plot the trends.</p>
<p>

</p>
<div>
<div>
<pre><span></span><span># Calculate trends</span>
tmp <span>&lt;-</span> <span>expand.grid</span><span>(</span>time <span>=</span> <span>0</span><span>:</span><span>10</span><span>,</span> 
                   subgroup <span>=</span> <span>c</span><span>(</span><span>&quot;A&quot;</span><span>,</span> <span>&quot;B&quot;</span><span>))</span>
X <span>&lt;-</span> model.matrix<span>(</span><span>~</span>subgroup <span>*</span> time<span>,</span> data <span>=</span> tmp<span>)</span>

b_hat <span>&lt;-</span> <span>summary</span><span>(</span>res<span>)</span><span>$</span><span>summary</span><span>$</span>default<span>$</span>FE<span>[,</span> <span>&quot;M_est&quot;</span><span>]</span>

tmp<span>$</span>y <span>&lt;-</span> <span>c</span><span>(</span>X <span>%*%</span> b_hat<span>)</span>

TE <span>&lt;-</span> tmp <span>%>%</span> 
  filter<span>(</span>time <span>==</span> <span>10</span><span>)</span> <span>%>%</span> 
  spread<span>(</span>subgroup<span>,</span> y<span>)</span>


<span># Plot treatment group only</span>
p0 <span>&lt;-</span> ggplot<span>(</span>tmp<span>,</span> 
       aes<span>(</span>time<span>,</span> 
           y<span>,</span> 
           group <span>=</span> subgroup<span>,</span> linetype <span>=</span> subgroup<span>,</span> color <span>=</span> subgroup<span>))</span> <span>+</span> 
  geom_line<span>(</span>aes<span>(</span>size <span>=</span> subgroup<span>))</span> <span>+</span>
  annotate<span>(</span><span>&quot;rect&quot;</span><span>,</span> 
           xmin <span>=</span> <span>10</span><span>,</span> 
           xmax <span>=</span> <span>Inf</span><span>,</span> 
           ymin <span>=</span> <span>-</span><span>Inf</span><span>,</span> 
           ymax <span>=</span> <span>Inf</span><span>,</span> 
           fill <span>=</span> <span>&quot;white&quot;</span><span>)</span> <span>+</span>
  geom_segment<span>(</span>data <span>=</span> TE<span>,</span> 
               aes<span>(</span>xend <span>=</span> time<span>,</span> 
                   y <span>=</span> A<span>,</span> 
                   yend <span>=</span> B<span>,</span>
                   linetype <span>=</span> <span>NULL</span><span>,</span>
                   color <span>=</span> <span>NULL</span><span>,</span> 
                   group <span>=</span> <span>NULL</span><span>),</span> 
               arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>),</span> ends <span>=</span> <span>&quot;both&quot;</span><span>)</span>
  <span>)</span> <span>+</span>
  geom_text_repel<span>(</span>data <span>=</span> filter<span>(</span>tmp<span>,</span> time <span>==</span> <span>10</span><span>),</span> 
                  alpha <span>=</span> <span>0.77</span><span>,</span>
                  aes<span>(</span>y <span>=</span> y<span>,</span> 
                      label <span>=</span> <span>paste</span><span>(</span><span>&quot;Subgroup: &quot;</span><span>,</span> subgroup<span>),</span> 
                      group <span>=</span> <span>NULL</span><span>),</span>
                  direction <span>=</span> <span>&quot;x&quot;</span><span>,</span>
                  xlim <span>=</span> <span>c</span><span>(</span><span>10.5</span><span>,</span> <span>NA</span><span>)</span>
  <span>)</span> <span>+</span>
  geom_text_repel<span>(</span>data <span>=</span> filter<span>(</span>tmp<span>,</span> time <span>==</span> <span>6</span><span>,</span> subgroup <span>==</span> <span>&quot;A&quot;</span><span>),</span> 
                  alpha <span>=</span> <span>0.77</span><span>,</span>
                  aes<span>(</span>y <span>=</span> y<span>,</span> 
                      label <span>=</span> <span>&quot;By only analyzing change within the treatment group\nwe get the impression that we can use Subgroup A to identify 'non-responders'&quot;</span><span>,</span> 
                      group <span>=</span> <span>NULL</span><span>,</span>
                      color <span>=</span> <span>NULL</span><span>),</span>
                  direction <span>=</span> <span>&quot;y&quot;</span><span>,</span>
                  arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>)),</span>
                  point.padding <span>=</span> <span>1</span><span>,</span>
                  ylim <span>=</span> <span>c</span><span>(</span><span>25</span><span>,</span> <span>NA</span><span>)</span>
  <span>)</span> <span>+</span>
  geom_text<span>(</span>data <span>=</span> TE<span>,</span>
            aes<span>(</span>group <span>=</span> <span>NULL</span><span>,</span> 
                color <span>=</span> <span>NULL</span><span>,</span> 
                linetype <span>=</span> <span>NULL</span><span>,</span>
                y <span>=</span> <span>(</span>A<span>+</span>B<span>)</span><span>/</span><span>2</span><span>,</span> 
                label <span>=</span> <span>paste</span><span>(</span><span>&quot;A - B:&quot;</span><span>,</span> <span>round</span><span>(</span>A <span>-</span> B<span>,</span> <span>0</span><span>))),</span> 
            point.padding <span>=</span> <span>1</span><span>,</span>
            direction <span>=</span> <span>&quot;x&quot;</span><span>,</span>
            nudge_x <span>=</span> <span>0.5</span><span>,</span>
            hjust <span>=</span> <span>0</span><span>,</span> 
            arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>)),</span>
            xlim <span>=</span> <span>c</span><span>(</span><span>10.5</span><span>,</span><span>NA</span><span>),</span>
            label.size <span>=</span> <span>NA</span><span>,</span> 
            segment.color <span>=</span> <span>&quot;gray35&quot;</span>
  <span>)</span> <span>+</span>  
  theme_minimal<span>()</span> <span>+</span>
  theme<span>(</span>legend.position <span>=</span> <span>&quot;none&quot;</span><span>)</span> <span>+</span>
  scale_color_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;B&quot;</span> <span>=</span> <span>&quot;gray50&quot;</span><span>,</span> 
                                <span>&quot;A&quot;</span> <span>=</span> <span>&quot;#00b894&quot;</span><span>))</span> <span>+</span>
  scale_size_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;B&quot;</span> <span>=</span> <span>0.75</span><span>,</span> <span>&quot;A&quot;</span> <span>=</span> <span>1</span><span>))</span> <span>+</span>
  coord_cartesian<span>(</span>xlim <span>=</span> <span>c</span><span>(</span><span>0</span><span>,</span> <span>14</span><span>),</span> ylim <span>=</span> <span>c</span><span>(</span><span>0</span><span>,</span> <span>30</span><span>))</span> <span>+</span>
  labs<span>(</span>title <span>=</span> <span>&quot;Treatment group only&quot;</span><span>)</span>


<span># Calculate trends for RCT</span>
tmp <span>&lt;-</span> <span>expand.grid</span><span>(</span>time <span>=</span> <span>0</span><span>:</span><span>10</span><span>,</span> 
                   treatment <span>=</span> <span>factor</span><span>(</span><span>0</span><span>:</span><span>1</span><span>,</span> labels <span>=</span> <span>c</span><span>(</span><span>&quot;Control&quot;</span><span>,</span> <span>&quot;Treatment&quot;</span><span>)),</span> 
                   subgroup <span>=</span> <span>c</span><span>(</span><span>&quot;A&quot;</span><span>,</span> <span>&quot;B&quot;</span><span>))</span>
X <span>&lt;-</span> model.matrix<span>(</span><span>~</span>subgroup <span>*</span> time <span>*</span> treatment<span>,</span> data <span>=</span> tmp<span>)</span>

b_hat <span>&lt;-</span> <span>summary</span><span>(</span>res2<span>)</span><span>$</span><span>summary</span><span>$</span>default<span>$</span>FE<span>[,</span> <span>&quot;M_est&quot;</span><span>]</span>

tmp<span>$</span>y <span>&lt;-</span> <span>c</span><span>(</span>X <span>%*%</span> b_hat<span>)</span>

TE <span>&lt;-</span> tmp <span>%>%</span> 
    filter<span>(</span>time <span>==</span> <span>10</span><span>)</span> <span>%>%</span> 
    spread<span>(</span>treatment<span>,</span> y<span>)</span>


<span># Plot RCT</span>
p1 <span>&lt;-</span> ggplot<span>(</span>tmp<span>,</span> 
       aes<span>(</span>time<span>,</span> 
           y<span>,</span> 
           group <span>=</span> <span>interaction</span><span>(</span>subgroup<span>,</span> treatment<span>),</span> 
           color <span>=</span> treatment<span>,</span> linetype <span>=</span> subgroup<span>))</span> <span>+</span> 
    geom_line<span>(</span>aes<span>(</span> size <span>=</span> treatment<span>))</span> <span>+</span>
    annotate<span>(</span><span>&quot;rect&quot;</span><span>,</span> 
             xmin <span>=</span> <span>10</span><span>,</span> 
             xmax <span>=</span> <span>Inf</span><span>,</span> 
             ymin <span>=</span> <span>-</span><span>Inf</span><span>,</span> 
             ymax <span>=</span> <span>Inf</span><span>,</span> 
             fill <span>=</span> <span>&quot;white&quot;</span><span>)</span> <span>+</span>
    geom_segment<span>(</span>data <span>=</span> TE<span>,</span> 
                 aes<span>(</span>xend <span>=</span> time<span>,</span> 
                     y <span>=</span> Treatment<span>,</span> 
                     yend <span>=</span> Control<span>,</span>
                     group <span>=</span> subgroup<span>,</span> 
                     linetype <span>=</span> <span>NULL</span><span>,</span>
                     color <span>=</span> <span>NULL</span><span>),</span> 
                 arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>),</span> ends <span>=</span> <span>&quot;first&quot;</span><span>)</span>
                 <span>)</span> <span>+</span>
    geom_text_repel<span>(</span>data <span>=</span> filter<span>(</span>tmp<span>,</span> time <span>==</span> <span>6</span><span>,</span> subgroup <span>==</span> <span>&quot;A&quot;</span><span>,</span> treatment <span>==</span> <span>&quot;Treatment&quot;</span><span>),</span> 
                  alpha <span>=</span> <span>0.77</span><span>,</span>
                  aes<span>(</span>y <span>=</span> y<span>,</span> 
                      label <span>=</span> <span>&quot;In the correct analysis we see that the 'non-responders'\nactually improved just as much as the 'responders'&quot;</span><span>,</span> 
                      group <span>=</span> <span>NULL</span><span>,</span>
                      color <span>=</span> <span>NULL</span><span>),</span>
                  direction <span>=</span> <span>&quot;y&quot;</span><span>,</span>
                  arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>)),</span>
                  point.padding <span>=</span> <span>1</span><span>,</span>
                  ylim <span>=</span> <span>c</span><span>(</span><span>25</span><span>,</span> <span>NA</span><span>),</span>
                  xlim <span>=</span> <span>c</span><span>(</span><span>NA</span><span>,</span> <span>8</span><span>)</span>
  <span>)</span> <span>+</span>
    geom_text_repel<span>(</span>data <span>=</span> filter<span>(</span>tmp<span>,</span> time <span>==</span> <span>10</span><span>),</span> 
                    alpha <span>=</span> <span>0.77</span><span>,</span>
                    aes<span>(</span>y <span>=</span> y<span>,</span> 
                        label <span>=</span> <span>paste</span><span>(</span>treatment<span>,</span> <span>&quot;: &quot;</span><span>,</span> subgroup<span>),</span> 
                        color <span>=</span> treatment<span>,</span> 
                        group <span>=</span> <span>NULL</span><span>),</span>
                    direction <span>=</span> <span>&quot;x&quot;</span><span>,</span>
                    xlim <span>=</span> <span>c</span><span>(</span><span>10.5</span><span>,</span> <span>NA</span><span>)</span>
                    <span>)</span> <span>+</span>
    geom_text<span>(</span>data <span>=</span> TE<span>,</span>
        aes<span>(</span>group <span>=</span> <span>NULL</span><span>,</span> 
            color <span>=</span> <span>NULL</span><span>,</span> 
            linetype <span>=</span> <span>NULL</span><span>,</span>
            y <span>=</span> <span>(</span>Treatment<span>+</span>Control<span>)</span><span>/</span><span>2</span><span>,</span> 
            label <span>=</span> <span>round</span><span>(</span>Treatment <span>-</span> Control<span>,</span> <span>0</span><span>)),</span> 
        point.padding <span>=</span> <span>1</span><span>,</span>
        direction <span>=</span> <span>&quot;x&quot;</span><span>,</span>
        nudge_x <span>=</span> <span>0.5</span><span>,</span>
        arrow <span>=</span> arrow<span>(</span>length <span>=</span> unit<span>(</span><span>0.02</span><span>,</span> <span>&quot;npc&quot;</span><span>)),</span>
        xlim <span>=</span> <span>c</span><span>(</span><span>10.5</span><span>,</span><span>NA</span><span>),</span>
        label.size <span>=</span> <span>NA</span><span>,</span> 
        segment.color <span>=</span> <span>&quot;gray35&quot;</span>
    <span>)</span> <span>+</span>  
    theme_minimal<span>()</span> <span>+</span>
    theme<span>(</span>legend.position <span>=</span> <span>&quot;none&quot;</span><span>)</span> <span>+</span>
    scale_color_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;Control&quot;</span> <span>=</span> <span>&quot;gray66&quot;</span><span>,</span> 
                                  <span>&quot;Treatment&quot;</span> <span>=</span> <span>&quot;#0984e3&quot;</span><span>))</span> <span>+</span>
    scale_size_manual<span>(</span>values <span>=</span> <span>c</span><span>(</span><span>&quot;Control&quot;</span> <span>=</span> <span>0.75</span><span>,</span> <span>&quot;Treatment&quot;</span> <span>=</span> <span>1</span><span>))</span> <span>+</span>
    coord_cartesian<span>(</span>xlim <span>=</span> <span>c</span><span>(</span><span>0</span><span>,</span> <span>14</span><span>),</span> ylim <span>=</span> <span>c</span><span>(</span><span>0</span><span>,</span> <span>30</span><span>))</span> <span>+</span> 
  labs<span>(</span>title <span>=</span> <span>&quot;Treatment and control&quot;</span><span>)</span>
</pre>
</div>
</div>
<p><img alt="center" title="center" src="https://i0.wp.com/rpsychologist.com/img/treatment-response-subgroup/treatment-response-subgroup-interaction-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>We see that the “non-responders” actually improved just as much as the “responders” when compared to the control group. The effect from the naïve within-group analysis clearly confounds treatment response with just “change”. You might think that there is no reason why Subgroup A would start deteriorating just as they enter the study. It is easy to think of different explanations for this; one explanation might be that the marker we used to identify the subgroup is related to some personality trait that makes participants more likely to seek treatment when they feel “good enough to start treatment”. It is not uncommon to hear such reasoning. During the study period these patients will tend to regress toward their typical symptom level, but the deterioration is somewhat slowed down thanks to the treatment. Patients in subgroup B on the other hand, seek treatment because they have felt worse than usual for a period. So our marker for “treatment response” do not identify responders and non-responders it simply identifies patients on different trajectories, i.e., it is a prognostic marker. </p>
<p>The point of this post is not just semantics (treatment response versus change). The take-home message is important: by using the naïve analysis and the unwarranted causal language, we risk spreading the misinformation that patients belonging to subgroup A do no benefit from the treatment, when in fact they do. This risks creating an unnecessary stigma for a patient group that might already be seen as “difficult”, and inspire suboptimal “personalized” treatments that could be less likely to work. </p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://rpsychologist.com/treatment-response-subgroup"> R Psychologist - R</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/sTNaJbxv7H4" height="1"></a></div>