DOI: 10.5281/zenodo.18195762
title: Causal inference reveals the dominant role of stronger climate-adaptation coupling in future potato production

description: README: Causal inference reveals the dominant role of stronger climate-adaptation coupling in future potato production

Dataset Description

This database contains the R scripts and data used to generate the figures for this study. The study systematically evaluates the potential of different adaptation measures for potato production in China under future climate change by integrating multi-crop model simulation results, climate projection data, and causal inference methods. It reveals the complex coupling effects between climate factors and adaptation measures.

Code Structure

Main Script

generate_figures.R: Contains the complete code for generating all 6 figures in the paper.

The code is organized by figure, including the following 6 main sections:

Figure 1: Potato yield change trends and regional differences in historical and future periods.

Figure 2: Yield change rates under different adaptation measures and the spatial distribution of optimal adaptation measures.

Figure 3: The impact of climate factors on yield revealed by random forest and SHAP analysis.

Figure 4: Causal effect (ATE) distribution of climate-adaptation coupling on potato yield.

Figure 5: Sensitivity estimation of the impacts of climate factors, adaptation measures, and their coupling effects on yield.

Figure 6: Spatial distribution and contribution decomposition of climate-adaptation coupling.

Data File Structure

Data is stored in the directory E:/Data and code/Data/, categorized by figure:

P1/: Data related to Figure 1

P2/: Data related to Figure 2

P3/: Data related to Figure 3

P4/: Data related to Figure 4

P5/: Data related to Figure 5

P6/: Data related to Figure 6

CNLP/: Spatial boundary data for the potato cultivation region on the Chinese Loess Plateau.

Output Files

Figures are saved in the E:/Data and code/Figure/ directory in TIFF format.

System Requirements

R version: ≥ 4.0.0

System memory: Recommended ≥ 16GB

Graphics device: Support for high-resolution graphics output.

Dependent Packages

# Data processing

library(data.table)    # Efficient data reading

library(tidyverse)     # Data wrangling and transformation

# Spatial data processing

library(sf)            # Spatial vector data processing

# Data visualization

library(ggplot2)       # Basic graphics system

library(scales)        # Graphics scale adjustment

library(ggridges)      # Ridge plots

library(ggbeeswarm)    # Beeswarm plots

library(ggnewscale)    # Multiple scale color system

# Figure assembly

library(cowplot)       # Figure composition

library(aplot)         # Figure insertion

# Others

library(viridis)       # Color scales

library(mgcv)          # GAM models

Usage Instructions

Basic Usage

Ensure all data files are in the correct directory structure.

Install all necessary R packages.

Running the script will automatically generate all figures and save them to the specified directory.

Custom Modifications

Data paths: Modify the file paths in the fread() function to match your local data storage location.

Output settings: Adjust the dimensions, resolution, and output format in the ggsave() function.

Figure style: Modify the theme() parameters to adjust the figure appearance.

Color scheme: Modify the scale_fill_*() and scale_color_*() functions to adjust color settings.

Notes

The code uses hard-coded paths; adjust them according to your local directory structure before first run.

Some figures require more memory; it is recommended to run on a computer with sufficient memory.

Generating all figures may take a long time (approximately 5-10 minutes).