There is a newer version of the record available.

Published August 8, 2024 | Version 1.0.0
Computational notebook Open

Data and code associated with: Towards causal predictions of site-level treatment effects for applied ecology

  • 1. ROR icon University of Reading
  • 2. ROR icon Swedish University of Agricultural Sciences
  • 3. ROR icon UK Centre for Ecology & Hydrology

Description

This repository contains the code and data for our preprint:

E. E. Jackson, T. Snäll, E. Gardner, J. M. Bullock & R. Spake (2025). Towards causal predictions of site-level treatment effects for applied ecology. EcoEvoRxiv. DOI: 10.32942/X2KK95

Article abstract:

With limited land and resources available to implement conservation actions, efforts must be effectively targeted to individual places. This demands predictions of how individual sites respond to alternative interventions. Meta-learner algorithms for predicting individual level treatment effects (ITEs) have been pioneered in marketing and medicine, but they have not been tested in ecology. We present a first application of meta-learner algorithms to ecology by comparing the performance of algorithms popular in other disciplines (S-, T-, and X-Learners) across a broad set of sampling and modelling conditions that are common to ecological observational studies. We conducted 4,050 virtual studies that measure the effect of forest management on soil carbon. These varied in sampling approach and meta-learner algorithm. The X-Learner algorithm that adjusts for selection bias yields the most accurate predictions of ITEs. Our findings pave the way for ecologists to leverage machine learning techniques for more effective and targeted management of ecosystems in the future.

Contents:

code/

The code/ directory contains these subdirectories:

  • scripts/ contains action scripts, i.e. all the code for cleaning, combining, and analysing the data. All paths in the scripts are relative to the root directory (where the .Rproj file lives). Each .R script has a summary at the top of what it does. The scripts are numbered in the order in which they would typically be run.
  • functions/ contains R functions which are called by scripts in the code/scripts/ directory. Note that functions were designed to be used only within this project.
  • notebooks/ contains .Rmd files that were used for exploratory analysis and note-taking. Notebooks are not intended to be reproducible but the .md files can be viewed as rendered html (with output) on GitHub.

data/

The original data is stored in the data/raw/ subdirectory. Any data that is produced using code is stored in data/derived/

output/

The output/ directory contains the subdirectory figures/, which contains the figures used in the paper.

docs/

The docs/ directory contains the data dictionary / metadata. 

Usage

To reproduce results and figures from this project in the RStudio IDE, first open the .Rproj file and call renv::restore() to restore the project's R package library. Then, run the .R scripts in code/scripts/ in the order in which they are labelled, starting from 02_identify-test-plots.R. Note that the first two scripts which clean and filter the data are for reference only, since we will be providing the cleaned data in this repository.

Files

tree-main.zip

Files (638.9 MB)

Name Size Download all
md5:308342ae5f853a5050ec5c1297fa91c5
638.9 MB Preview Download

Additional details

Related works

Is supplement to
Preprint: 10.32942/X2KK95 (DOI)

Funding

Natural Environment Research Council
Transferable Ecology for a changing world (TREE) NE/X009998/1

Software

Repository URL
https://github.com/ee-jackson/tree/tree/main
Programming language
R