rpsychologist / causal-therapist-effects-paper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Causal Inference Perspective on Therapist Effects

This repository contains the code required to reproduce all figures and simulations reported in the manuscript, A Causal Inference Perspective on Therapist Effects (Magnusson, in preparation).

Materials

  • Preprint
    • A publicly available version of the manuscript in advance of peer-review and formal publication
  • OSF repository
  • Online analysis supplement (PDF, HTML)
    • The rendered versions of supplement.qmd
  • Interactive visualization
    • An interactive visualization of the overlap measures described in the manuscript

Reproducibility

You can render the supplement using either your local R installation or by using Docker.

The Quarto files will be output to docs/ and figures to figures/.

Build using a local R installation

The following dependencies are needed:

  • R (v4.3.0)
  • Quarto (v1.3.353)
    • With a working LaTeX installation
  • Renv (v0.17.3)

Then simply run:

R -e 'renv::restore()'
quarto render

Build using Docker

You can also build the project using Docker, without having to install any additional dependencies.

docker build \
    --build-arg R_VERSION=4.3.0 \
    --build-arg QUARTO_VERSION=1.3.353 \
    --build-arg RENV_VERSION=0.17.3 \
    -t causal-therapist-effects .

Then use the Docker image to run the simulation and render the Quarto project inside a new container.

docker run \
    --rm \
    -v "$(pwd)/supplement.qmd:/home/supplement.qmd" \
    -v "$(pwd)/_quarto.yml:/home/_quarto.yml" \
    -v "$(pwd)/docker/figures:/home/figures" \
    -v "$(pwd)/docker/docs:/home/output" \
    -v "$(pwd)/docker/tmp:/home/tmp" \
    -e MAX_CORES=8 \
    -e N_SIM=10000 \
    -e N_SIM_CI=1000 \
    causal-therapist-effects

The variable MAX_CORES controls how many CPU cores the simulation will use, N_SIM sets the number of simulations for the confounding example, and N_SIM_CI controls the confidence interval simulation.

Remove ./docker/tmp/simulation.rds to rerun the simulation.

Blinded output

The "blinded" profile can be used for masked peer review. Masked documents will be saved to ./docs-blinded

quarto render --profile blinded

About


Languages

Language:R 84.9%Language:TeX 10.6%Language:Dockerfile 3.6%Language:Lua 0.5%Language:Shell 0.4%