1

Context

When conducting a Randomized-Controlled Trial (RCT), some participants are randomly assigned to a treatment condition, and others to a control group. However, not everyone assigned to the treatment might follow the treatment protocol (called "treatment compliance").

According to Sagarin et al. (2014), one sensible approach to address this problem is using the complier average causal effect (CACE), also sometimes known as Local average treatment effect (LATE). According to Wikipedia, it is "the treatment effect for the subset of the sample that takes the treatment if and only if they were assigned to the treatment, otherwise known as the compliers." In other words, it will be useful if a proportion of your participants assigned to the treatment group did not follow the treatment protocol.

Question

How do you run this analysis in R?

I couldn't find anything precise on this from Google and stackoverflow searches.

Also despite my many readings, I still cannot figure out what the expected outcome is supposed to be. When using CACE, what is the outcome? Do you end up with updated scores/data ajusted for treatment non-compliance that you can just plug in your regular analyses (akin to factor scores)? Or do you simply get some kind of number that you have to do something with?

What I've tried

The eefAnalytics package seems to provide the most convenient function for this: caceSRTBoot(). "caceSRTBoot performs exploraty CACE analysis of simple randomised education trials." It allows to specify compliance through a simple compliance percentage (beautifully simple and convenient).

However, I am experiencing some problems installing the eefAnalytics package while trying to test it to see the kind of output it gives:

install.packages("eefAnalytics")
package ‘eefAnalytics’ is not available (for R version 4.0.2)

# Install the latest version of this package by entering the following in R:
install.packages("eefAnalytics", repos="http://R-Forge.R-project.org")
package ‘eefAnalytics’ is not available (for R version 4.0.2)
Warning in install.packages :
  unable to access index for repository http://R-Forge.R-project.org/bin/windows/contrib/4.0:
  cannot open URL 'http://R-Forge.R-project.org/bin/windows/contrib/4.0/PACKAGES'

Upon closer investigation, Cran says: "Package ‘eefAnalytics’ was removed from the CRAN repository."

The other packages I've looked at (e.g., 1, 2, 3, 4) seemed quite complicated and I couldn't figure them out (they don't have a parameter for % compliance for instance, and I had trouble making their "Run this example" widget work). Is there any other user-friendly package out there? Is there any other way to do this analysis in R? Would anyone have some kind of "tutorial"?

Relevant pages: 1.

rempsyc
  • 785
  • 5
  • 24
  • Not really yet ready for coding. It's more of a design problem/package recommendation rather than a coding specification. – IRTFM Sep 29 '20 at 23:53
  • @IRTFM, thanks for your comment! Is this a note to me or an invitation to edit my question? Or is it that the question is not appropriate for SO? Is there anything else I should do? Best, – rempsyc Oct 01 '20 at 14:41
  • It was an explanation of my close vote. Seems to be a methods and package recommendation Q. You do not appear to have read [ask] and I think you should be seeking out sites where methodology questions are solicited and welcome. SO is not one of those. SO seeks compact questions with available data for demonstration. See [MCVE]. – IRTFM Oct 01 '20 at 20:54
  • @IRTFM, I see, thanks for the explanation. I'd be happy for an "how-to-code-it-in-R" kind of answer, too. I was wondering how others did this analysis in R (surely others do it). I read the How to Ask before (and reread it again) and I do not see how my question misfits with the guidelines (is it "Not all questions benefit from including code. But if your problem is with code you've written, you should include some"? As I did include some code). I believe Cross Validated would reject my question for example, as "too technical" rather than statistical. What other such sites would you recommend? – rempsyc Oct 05 '20 at 17:45
  • 1
    Hey, I got the same question as you did and failed to install this package. Did you end up using eefAnalytics to run the CACE analysis or did you find alternative way of doing so? – yihan Jan 18 '22 at 01:00

1 Answers1

1

Installing the eefAnalytics package

I contacted the eefAnalytics package maintainer through the package documentation. I was told that an updated version will be available soon in R. In the meanwhile, I was able to install the old version of the package from the CRAN archives with:

install.packages("https://cran.r-project.org/src/contrib/Archive/eefAnalytics/eefAnalytics_1.0.6.tar.gz", repos = NULL, type = "source")

Note, however, that I had to manually install packages geoR and metafor separately first (else it was throwing an error).

Running the Causal Average Treatment Effect

Answering the first part of the question:

How do you run this analysis in R?

Running the example available from documentation for a simple randomised trial, we get:

library(eefAnalytics)    
data(mstData)
############# weighted ITT ####################################
caceOutput3 <- caceSRTBoot(Posttest~ Prettest+ Intervention,
               intervention="Intervention",
               compliance = "Percentage_Attendance",nBoot=1000,data=mstData)

cace <- caceOutput3$CACE
cace
  Compliance   ES   LB   UB
1       P> 0 0.32 0.04 0.62
2      P> 10 0.32 0.04 0.62
3      P> 20 0.37 0.04 0.72
4      P> 30 0.42 0.05 0.83
5      P> 40 0.47 0.06 0.92
6      P> 50 0.58 0.07 1.18

Complier <- caceOutput3$Compliers
Complier    
        P > 0 P > 10 P > 20 P > 30 P > 40 P > 50 P > 60 P > 70 P > 80 P > 90
pT          1      1   0.87   0.75   0.69   0.55   0.41   0.31   0.25   0.15
pC          0      0   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
P=PT-pC     1      1   0.87   0.75   0.69   0.55   0.41   0.31   0.25   0.15

### visualising CACE effect size

plot(caceOutput3)

enter image description here

Interpretation of output

I couldn’t find this information from the package documentation, but from what I understand from the output:

ITT = intent to treat

ES = effect size (Hedge’s g)

LB = lower-bound (of the confidence interval of the effect size)

UB = upper-bound

pT = Percentage of compliers in Treatment group

pC = Percentage of compliers in Control group

P=PT-pC = Percentage of compliers in Treatment group minus Percentage of compliers Control group

P > X = Value for participants with a percentage of compliance greater than X (e.g., 50%)

What is the outcome?

To answer the second part of the question:

When using CACE, what is the outcome?

The main outcome of interest seems to be an adjusted effect size (Hedge's g, which is similar to Cohen's d but better for small sample sizes < 20). It seems only possible to compare two groups together, not more (as Hedge's g, like Cohen's d, can only compare two means at once).

The plot is very useful and allows to see the "improvement" of the effect size as a function of increasing compliance with treatment. What you see in this example is that a higher compliance percentage leads to larger effect sizes, as expected.

rempsyc
  • 785
  • 5
  • 24
  • 1
    Thank you very much for your answer! I've tried the newest R package, but got the same error that this thread opener got. And when I tried running your code to install the old package and the pre-requisite packages (geoR and metafor), I got the error saying that I need to install RandomFieldsUtils, which cannot be installed now. Are you still able to run the code? Or did you find alternative way of running CACE analysis? – yihan Jan 18 '22 at 00:56
  • @yihan I just tried `library(eefAnalytics)` and the library loaded with version `1.0.8`. However, trying to run the code above, I get the following error message: `Error: 'caceSRTBoot' has been removed from this package. Please use it from eefAnalytics 1.0.6`. I tried reinstalling it and then got version `1.0.11`. I unfortunately do not have sufficient time to investigate this deeper. It seems like they have updated their function names so you would need to look at their new documentation. Hope it helps. Edit: my answer above downloads version `1.0.6` that's why my version `1.0.8` didn't work. – rempsyc Jan 18 '22 at 01:17
  • @yihan OK so I just tried uninstalling the package completely and then reinstalling version `1.0.6` exactly as in my code above and tried the code again and it works for me. I checked and I do have the `RandomFieldsUtils` library version 0.5.3. I think you should be able to solve your issue if you can install the `RandomFieldsUtils` library. – rempsyc Jan 18 '22 at 01:42