<figure><img src="image_1.png" /></figure>

HAL
open science

# rcontroll: An R interface for the individual-based forest dynamics simulator TROLL

Sylvain Schmitt, Guillaume Salzet, Fabian Jörg Fischer, Isabelle Maréchaux,

Jerome Chave

► To cite this version:

Sylvain Schmitt, Guillaume Salzet, Fabian Jörg Fischer, Isabelle Maréchaux, Jerome Chave. rcontroll: An R interface for the individual-based forest dynamics simulator TROLL. Methods in Ecology and Evolution, In press, 10.1111/2041-210x.14215. [https://doi.org/10.1111/2041-210x.14215](https://doi.org/10.1111/2041-210x.14215). [hal-04225109](https://HAL.inrae.fr/hal-04225109)

HAL Id: hal-04225109

https://hal.inrae.fr/hal-04225109

Submitted on 2 Oct 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_3.png" /></figure>

# rcontroll: An R interface for the individual-based forest dynamics simulator TROLL

Sylvain Schmitt¹ ID | Guillaume Salzet²,³ ID | Fabian Jörg Fischer⁴,⁵ ID |
Isabelle Maréchaux⁶ ID | Jerome Chave⁵ ID

¹CNRS, UMR EcoFoG (Agroparistech, Cirad, INRAE, Université des Antilles, Université de la Guyane), Kourou, French Guiana; ²INRAE, UMR BETA (AgroParistech, CNRS, Université de Lorraine, Université de Strasbourg), Nancy, France; ³INRAE, UMR EcoFoG (Agroparistech, Cirad, CNRS, Université des Antilles, Université de la Guyane), Kourou, French Guiana; ⁴School of Biological Sciences, University of Bristol, Bristol, UK; ⁵Laboratoire Evolution et Diversité Biologique, UMR5174, CNRS, Université Paul Sabatier, IRD, Toulouse Cedex 9, France and ⁶AMAP, Univ Montpellier, INRAE, IRD, CIRAD, CNRS, Montpellier, France

**Correspondence**

Sylvain Schmitt

Email: sylvain.m.schmitt@gmail.com

**Funding information**

Agence Nationale de la Recherche,
Grant/Award Number: ANAEE-France:
ANR-11-INBS-0001, TULIP: ref. ANR-10-
LABX-0041 and CEBA: ref. ANR-10-LABX-
25-01; CNES (BIOMASS-VALO TOSCA
Project); LECOS Project

Handling Editor: Aaron Ellison

**Abstract**

1. A central challenge in ecology is understanding the emergence of patterns as the result of interactions among individuals. Dynamic forest models can provide a fine-scale description of the ecological, physiological and environmental processes that explain the demography of coexisting tree species. This in turn helps predict changes under future scenarios. However, model accessibility is a major obstacle to a wide use and communication across scientific disciplines and for educational purposes.

2. Here, we present the R package *rcontroll*, which provides access to the *TROLL* forest simulator in the R environment. *TROLL* is individual-based and spatially explicit and leverages knowledge of ecology, biogeochemistry and tree ecology through a trait-based parameterisation. *TROLL* has been used to simulate carbon fluxes and tree diversity in tropical and subtropical forests and to explore forest resilience to disturbance and environmental changes more generally. *rcontroll* provides a user-friendly environment to set up and analyse *TROLL* simulations with varying community compositions, ecological parameters and climate conditions.

3. We show how to test parameter sensitivity in *TROLL* using the *rcontroll* R package. We also demonstrate the flexibility and ease of use of *rcontroll* by replicating a previously published study based on the *TROLL* simulator. Both examples are included with reproducible code documents.

4. Complex forest simulators are important scientific tools for science and education, and wide access to these tools is an important condition for their adoption. *TROLL* is designed to address a wide range of ecological and environmental questions, and the new R package *rcontroll* is designed to be an entry point for *TROLL* model users.

This is an open access article under the terms of the [Creative Commons Attribution-NonCommercial License](https://creativecommons.org/licenses/by-nc), which permits use, distribution and reproduction in any medium, provided the original work is properly cited and is not used for commercial purposes.

© 2023 The Authors. *Methods in Ecology and Evolution* published by John Wiley & Sons Ltd on behalf of British Ecological Society.

<figure><img src="image_4.png" /></figure>
KEYWORDS

forest simulator, individual-based model, R package, spatially explicit, TROLL

# 1 | INTRODUCTION

Forests are often conceptualised as a dynamic collection of individual trees responding in different and complex ways to local interactions, environmental change and natural and anthropogenic disturbances (Levin, 1998; Shugart, 1984). Forests, as major stores of carbon, home to considerable biodiversity and providers of key ecosystem services, also are at the nexus of the environmental challenges of this century. They are threatened, being exposed to a wide range of impacts, including commodity-driven deforestation, forestry, shifting agriculture and wildfires (Curtis et al., 2018), and to the consequences of climate change (Hubau et al., 2020; Saatchi et al., 2013). To understand how the processes that govern forest dynamics interact and how forests will respond to anthropogenic pressure, it is vital to produce biologically informed scenarios and for this models are important tools (Fisher et al., 2018; Shugart et al., 2018).

Modern forest IBMs are usually written in high-performance languages such as C++ or Fortran, with platform-specific compilation challenges. Until now, forest IBMs have therefore been limited to a small number of expert users, typically core developers. This contrasts with other modelling approaches, such as species distribution models (SDMs) which also require complex, low-level code, but which have been widely adopted, in part due to the wide availability of tools and R packages for researchers and students (Phillips et al., 2006; Schmitt et al., 2017). Conversely, few forest IBMs are currently available as R packages—plant being a rare example (Falster et al., 2016)—making it difficult to reproduce research and to use IBMs in applied settings, both in research and beyond.

Forest models create links between a range of data to simulate forest dynamics on spatial and temporal scales inaccessible to empirical studies (Marechaux et al., 2020). In the diverse family of forest dynamic models, individual-based models (IBMs) are unique in simulating the growth and demography of each individual tree, and in the relative ease with which they integrate field data to simulate ecological and physiological processes. Remarkably, from a historical perspective, IBMs were also the first type of numerical forest models, developed in the early 1960s for the purpose of optimising the yield of plantations (Ek & Monserud, 1974) and soon after to extend modelling capacities to any forest type (Shugart & West, 1980). Individual-based forest simulators have since proved useful for studying species-rich tropical forests (Kazmierczak et al., 2014; Köhler & Huth, 1998; Purves & Pacala, 2008; Urban et al., 1991) and for addressing a broad range of fundamental and applied questions (Marechaux et al., 2020), such as the effect of biodiversity on forest functioning through virtual experiments (Maréchaux & Chave, 2017; Morin et al., 2014; Sakschewski et al., 2016; Schmitt et al., 2020), or the quantification of forest carbon stocks and fluxes (Fischer et al., 2015; Fyllas et al., 2017). By leveraging remote-sensing

products, IBMs have expanded both their spatial scale of application and range of parameterisation (Fischer et al., 2019; Rödig et al., 2017, 2018; Shugart et al., 2015), and remote-sensing products have been benchmarked with the aid of virtual remotely sensed scenes (Knapp et al., 2018).

To fill this gap, we present an R package named *rcontroll*, which integrates the *TROLL* individual-based model into R to simulate forest ecosystem processes and species dynamics. The *TROLL* model was originally developed for tropical forests, with the aim of simulating ecological succession from bare ground and the spatial patterns emerging from tree falls and gap dynamics (Chave, 1999). Species-specific parameters are based on plant functional traits allowing the joint simulation of carbon and tree diversity (Maréchaux & Chave, 2017). *TROLL* has been applied to the study of tropical forest resilience (Schmitt et al., 2020), tree allometry and how it can be inferred from remote sensing (Fischer et al., 2019), and forest responses to wind-throw (Rau et al., 2022).

*rcontroll* provides user-friendly functions for setting up and analysing *TROLL* simulations. Users specify floristic community composition, ecological parameters and climatic conditions, and default values are available where possible. *rcontroll* provides default data for demonstration runs, a climate data generator from a global dataset, visualisation tools as well as a generator of virtual LIDAR point clouds. Here, we demonstrate the flexibility of *rcontroll* by testing the sensitivity of *TROLL* parameters and replicating analyses from a previously published study using reproducible code examples.

# 2 | MATERIALS AND METHODS

## 2.1 | TROLL model

*TROLL* is a spatially explicit and individual-based forest model. We provide a short overview in the following section and a schematic diagram illustrating the functioning of *TROLL* (Figure 1a), but refer the reader to the original *TROLL* publications for further details (Chave, 1999; Maréchaux & Chave, 2017, Appendix S5, Figure S1 therein for another schematic diagram).

Tree growth and competition in *TROLL* happen in a 3D space, which is discretised into voxels of one cubic metre. Within this space, trees establish, grow and interact with each other, both vertically and horizontally, with at most one tree per square metre. A simplified tree geometry is adopted: the tree trunk is represented by a cylinder, characterised by its diameter at breast height (DBH) and total height; its crown has a symmetrical geometric shape such as a cylinder, cone or elliptical surface, which is characterised by its radius and depth and adjustable via shape parameters. Each tree is attributed to a botanical species with corresponding species-specific
<figure><img src="image_5.png" /><figcaption>FIGURE 1 TROLL forest simulator. (a) TROLL is a spatially explicit and individual-based forest model, which simulates carbon assimilation and allocation (light green), trunk and crown growth (light green), seed dispersal (brown) and tree deaths (red) and recruitments (dark green). (b) Output from a TROLL simulation using the autogif function in the rcontroll package. The image shows a vertical cut in the forest structure along the x-axis (in metres) with individual tree height (metres) on the y-axis. The tree colours indicate the identity of the species and can be changed using the ggplot2 grammar. The figure shows the forest structure after 625 years of a successional trajectory starting from bare ground, which can be seen dynamically over 200 years at https://raw.githubusercontent.com/sylvainschmitt/rcontroll/main/inst/figures/troll.gif.</figcaption></figure>

plant functional traits related to ecophysiological processes, includ-
ing photosynthesis, carbon allocation and mortality, as well as tree
architecture. Specifically, these traits include leaf mass per area LMA
(gm⁻²), leaf nitrogen N (mgg⁻¹), leaf phosphorus P (mgg⁻¹) and wood
density WD (gcm⁻³), as well as two parameters hmax and ah which
describe allometric growth between trunk diameter dbh (m) and tree
height h (m) according to a Michaelis–Menten equation: h = (hmax × dbh) / (dbh + ah).
Horizontal growth of crown radius cr is modelled according to a
power law cr = a × dbhᵇ, with parameters a and b specified at the
community level. Crown depth cd is modelled as a fixed fraction of
tree height.

New trees are recruited into the community from a seed bank
that is filled by an external seed rain. If the simulated stand con-
tains mature trees, these will also contribute to the seed rain. Each
model iteration, a random seed is selected from the seedbank
and, provided that the environmental conditions are favourable

for tree growth (the potential tree's light compensation point is
exceeded), turned into a seedling of 1cm DBH. Otherwise, the
grid cell remains empty. For each tree thus established, TROLL
simulates carbon assimilation, carbon allocation, trunk and crown
growth, seed dispersal and tree death (Figure 1a). TROLL uses the
C3 photosynthesis model of Farquhar et al. (1980), a function of
local temperature, light irradiance, vapour pressure deficit and at-
mospheric CO2 concentration. Model parameters, including the
maximum rate of carboxylation, Vcmax and the maximum electron
transport capacity, Jmax, are inferred from the species-specific
plant functional traits N, P and LMA (Domingues et al., 2010).
Solar irradiance is calculated within each voxel as the fraction
of irradiance transmitted by the voxels above following a Beer-
Lambert law, while temperature and vapour pressure deficit are
varying throughout the canopy according to empirical functions
(Maréchaux & Chave, 2017). Carbon assimilation is calculated
half-hourly for a representative day per month. Stomatal con-
ductance responds to air vapour pressure deficit and is modelled
according to Medlyn et al. (2011). Net assimilable carbon is calcu-
lated as gross assimilable carbon through photosynthesis minus
respiration (Atkin et al., 2015) and is allocated to trunk and root
growth, leaf production and reproduction based on empirical rela-
tionships and the biomass density of each component (LMA, WD).
If leaf area reaches its optimum, no further leaves are allocated,
and the excess carbon is allocated to growth or a storage pool
(Fischer, 2019). Tree growth results in a change in tree height and
crown size following DBH-driven allometries, which in turn influ-
ence the light environment at the next time step. In TROLL, tree
mortality results from three distinct processes: (i) stochastic mor-
tality, modelled as a function of a maximum background mortality
rate and a linearly decreasing relationship with species-specific
wood density; (ii) carbon starvation, if net assimilated carbon is
negative over a consecutive period exceeding the leaf lifespan;
and (iii) stochastic treefall events, assumed to depend on a tree
height threshold.

The combination of these processes at the individual level leads
to realistic community-level dynamics, including successional pat-
terns in species composition, self-thinning and gradual saturation
of stand biomass on decadal to centennial timescales even with
minimal calibration (Maréchaux & Chave, 2017; Rau et al., 2022).
The minimal set of input files required for a TROLL run include (i)
climate data for the focal location, (ii) functional traits for the list
of species at the focal location and (iii) global parameters, that is
parameters that do not depend on species identity. All these input
files and simulation parameters can be easily configured and run
using *rcontroll*.

## 2.2 | *rcontroll* workflow and usage

TROLL is coded in C++, and it typically simulates hundreds of thou-
sands of individuals over hundreds of years in several hectares in
minutes (a simulation over 4ha and 600years lasts ca. 1 min on
a typical personal computer). The *rcontroll* R package is a wrapper of *TROLL* that comprises the model and facilitates its access to users. *rcontroll* currently calls version 3.1.7 of *TROLL* using the *Rcpp* package (Eddelbuettel & François, 2011). *rcontroll* includes functions that generate inputs for simulations and run simulations. Finally, it is possible to analyse the *TROLL* outputs through tables, figures and maps taking advantage of other R visualisation packages. *rcontroll* also offers the possibility to generate a virtual LIDAR point cloud that corresponds to a snapshot of the simulated forest.

## 2.3 | Construction and manipulation of input files

As stated above, three types of input data are needed for a typical *TROLL* simulation: (i) climate data, (ii) plant functional traits and (iii) global model parameters. Presimulation functions include global parameters definition (*generate_parameters* function) and climate data generation (*generate_climate* function). *rcontroll* also includes default data for species and climate inputs for a typical French Guiana rainforest site. The purpose of the *generate_climate* function with the help of the corresponding vignette is to create *TROLL* climate inputs from ERA5-Land (Muñoz-Sabater et al., 2021), a global climatic reanalysis dataset that is freely available (see Supplementary Information S11). The ERA5-Land climate reanalysis is available at 9 km spatial resolution and hourly temporal resolution since 1950, and daily or monthly means are available and their uncertainties reported. Therefore, *rcontroll* users only need to input the species-specific trait data to run *TROLL* simulations, irrespective of the site. *TROLL* was originally developed for tropical and subtropical forests, so certain assumptions must be critically examined when applying it outside the tropics. The input files can be used to start a *TROLL* simulation run within the *rcontroll* environment (see below) or saved so that the *TROLL* simulation can be started as a command line tool.

## 2.4 | Simulations

The default option is to run a *TROLL* simulation using the *troll* function of the *rcontroll* package. The output is stored in a *trollsim* R class. For multiple runs, users can rely on the *stack* function, and the output is stored in the *trollstack* class. Both *trollsim* and *trollstack* values can be accessed using object attributes in the form of simple R objects (with @ in R). They consist of eight simulation attributes: (1) name, (2) path to saved files, (3) parameters, (4) inputs, (5) log, (6) initial and final state, (7) ecosystem output metrics and (8) species output metrics. The initial and final states are represented by a table with the spatial position, size and other relevant traits of all trees at the start and end of the simulation. The ecosystem and species metrics are summaries of ecosystem processes and states, such as net primary production and above-ground biomass, and they are documented at species level and

aggregated over the entire stand. Simulations can be saved using a user-defined path when run and later loaded as a simple simulation (*load_output* function) or a stack of simulations (*load_stack* function).

## 2.5 | Simulated airborne LIDAR scanning option

*TROLL* also has the capacity of generating point clouds from virtual aerial LIDAR scanning of simulated forest scenes. Within each cubic metre voxel of the simulated stand, points are generated probabilistically, with the probability depending both on the amount of light reaching the particular voxel and the amount of leaf matter intercepting light within the voxel. Extinction and interception of light are based on the Beer-Lambert law, but an effective extinction factor is used to account for differences between the near-infrared and visible light. The definition of the LIDAR parameters (*generate_lidar* function) is optional but allows the user to add a virtual aerial LIDAR scan for a time step of the *TROLL* simulation. When this option is enabled, the cloud of points from simulated aerial LIDAR scans is stored as LAS using the R package *lidR* (Roussel et al., 2020) as a ninth attribute of the *trollsim* and *trollstack* objects.

## 2.6 | Manipulation of simulation outputs

*rcontroll* includes functions to manipulate simulation outputs. Simulation outputs can be retrieved directly from the *trollsim* or *trollstack* objects and summarised or plotted in the R environment with the *print*, *summary* and *autoplot* functions. The *get_chm* function allows users to retrieve canopy height models from aerial LIDAR point clouds (Figure 2). In addition, a *rcontroll* function is available to visualise *TROLL* simulations as an animated figure (*autogif* function, Figure 1b).

# 3 | APPLICATIONS

## 3.1 | Sensitivity of TROLL parameters

As a first example, we performed a sensitivity analysis of 12 parameters (Table 1), the results of which could be used for effective model calibration. Calibration of *TROLL* consists of adjusting the parameter values so that the model behaves as closely as possible to the empirical data. We simulated an undisturbed forest plot located in French Guiana based on the inventory data from the Paracou research station (Gourlet-Fleury et al., 2004). We retained only the species provided as defaults in *rcontroll*. We sampled the parameter space using the Latin hypercube sampling (LHS) method, using the a priori parameter ranges (Table 1). LHS was modified to account for the expected correlation between parameters (Fischer, 2019) using the Huntington-Lyrintzis algorithm (Huntington & Lyrintzis, 1998) implemented in the *pse* R package (Chalom & Prado, 2017). Parameter combinations were replicated 10 times to assess stochastic variation
<figure><img src="image_6.png" /><figcaption>FIGURE 2 Comparison of clouds of points obtained from a virtual airborne LIDAR scan of a forest scene simulated with TROLL (a) with a real airborne LIDAR scan from Nouragues station (b). The horizontal axes represent the x-axis and y-axis (in metres), and the vertical axis represents height (in metres). The thermal colour scale indicates the height of the points in the cloud, from 0m in dark blue to 50m in red. The LIDAR simulator is not a ray tracing algorithm, but an approximation of the real laser scans, and the comparison shows among other things simplified geometric shapes of the trees and no return loss due to oblique angles.</figcaption></figure>

<table><caption>TABLE 1 Parameters used for the sensitivity analysis. Parameters have been classified by associated processes. The a priori interval used for sensitivity analysis is given for each parameter with its source.</caption><thead><tr><th>Processes</th><th>Parameters</th><th>A priori interval</th><th>Source</th></tr></thead><tbody><tr><td rowspan="3">Leaf ecophysiology</td><td>k<sub>light</sub>: light extinction coefficient (dimensionless)</td><td>[0.50, 0.95]</td><td rowspan="3">Maréchaux and Chave (2017)</td></tr><tr><td>Φ: apparent quantum yield for C fixation (molC. molphotons<sup>-1</sup>)</td><td>[0.04, 0.09]</td></tr><tr><td>g<sub>1</sub>: stomatal conductance parameter (kPa)</td><td>[2.00, 5.00]</td></tr><tr><td rowspan="2">Carbon allocation</td><td>f<sub>wood</sub>: fraction of NPP allocated to wood growth (%)</td><td>[0.01, 1.00]</td><td rowspan="2">f<sub>wood</sub> + f<sub>canopy</sub> + f<sub>leaf</sub> = 1</td></tr><tr><td>f<sub>canopy</sub>: fraction of NPP allocated to canopy (%)</td><td>[0.01, 1.00]</td></tr><tr><td rowspan="3">Mortality</td><td>m<sub>0</sub>: maximal basal mortality rate (events. year<sup>-1</sup>)</td><td>[0.01, 0.05]</td><td>Fischer (2019)</td></tr><tr><td>wsg<sub>lim</sub>: wood specific gravity limiting mortality factor (dimensionless)</td><td>[1.00, 1.20]</td><td>Maréchaux and Chave (2017)</td></tr><tr><td>V<sub>c</sub>: treefall stochastic threshold (dimensionless)</td><td>[0.01, 0.15]</td><td>Rau et al. (2022)</td></tr><tr><td rowspan="2">Reproduction</td><td>seedrain: Total number of reproduction opportunities coming from outside</td><td>[100, 100,000]</td><td>Maréchaux and Chave (2017)</td></tr><tr><td>nbs<sub>0</sub>: local seed dispersed par mature tree</td><td>[1, 1000]</td><td></td></tr><tr><td rowspan="2">Crown allometry</td><td>CR<sub>a</sub>: intercept of Log-Log regression to infer crown radius from DBH</td><td>[1.5, 3]</td><td rowspan="2">Fischer (2019) with a correlation factor: ρ = 0.65</td></tr><tr><td>CR<sub>b</sub>: slope of Log-Log regression to infer crown radius from DBH</td><td>[0.4, 0.8]</td></tr></tbody></table>

(500 combinations × 10 replications leading to 5000 simulations). Simulations were run from an initial bare ground for 600 years using the stack function in rcontroll, and they were subsequently summarised into four ecosystem metrics averaged over the last 100 years: the number of trees ≥10cm DBH, the number of trees ≥30cm DBH, above-ground biomass and gross primary production. To convert the discrete response into a continuous response function, covering the entire space of the 12 parameters, we derived a Gaussian process model for each ecosystem metric from the repeated samples using the hetGP R package (Binois & Gramacy, 2021). This surrogate

method allows us to generate any number of additional simulations for any parameter combination and yields robust mean estimates of ecosystem metrics with TROLL parameters independent from the noise generated from replications.

Finally, a sensitivity analysis was carried out using the sensitivity R package to determine the relative influence of the 12 parameters on the mean estimates of the four ecosystem metrics. We used Morris analysis, a qualitative approach to eliminate non-influential parameters (Morris, 1991). Morris analysis is based on a one-step-at-a-time sampling scheme (i.e. at each run, only one
input parameter is given a new value), which infers the effects of each parameter on the ecosystem metrics. The sensitivity factors can be compared globally, and the nonlinearity and interaction of the model is described qualitatively. The Morris analysis highlighted *TROLL* sensitivity to the parameters $CR_a$ of the allometric relationship between crown radius and trunk diameter, the fraction of net primary productivity allocated to the canopy $f_{canopy}$ and the apparent quantum yield for carbon fixation $\phi$ (Figure 3; Fischer et al., 2019; Maréchaux & Chave, 2017). The Morris analysis also revealed the importance of nonlinear effects or interactions of the tested parameters on the four ecosystem metrics, which can be explored further quantitatively with variance-based analyses (e.g. Sobol indices, see Supplementary Information SI2 and SI3). Thus, use case shows how *rcontrol* helps handle complex and simulation-intensive experiments, fostering our understanding of the *TROLL* model behaviour, and hence of model predictions and uncertainties, as well as its transferability.

## 3.2 | Functional diversity and forest resilience

As a second example of *rcontrol* application, we revisited the question: does functional diversity improve the tropical forest resilience to disturbance, which has been previously addressed in a virtual experiment using *TROLL* (Schmitt et al., 2020). We

replicated a scaled-down version of this experiment to demonstrate how the *rcontrol* interface facilitates the implementation of a simulated experiment such as this one (Supplementary Information SI4 and SI5). For three levels of species richness (5, 10 and 20), we simulated 10 random assemblages of communities whose composition from the default *TROLLv3* dataset included in *rcontrol* (resulting in 30 simulations). This was done using the *stack* function. Simulations were initialised from bare ground and run for 600 years to reach a mature forest state. We then sampled half of the individual trees and removed the rest to simulate a random disturbance (simplified from Schmitt et al., 2020). After the disturbance stage, forest dynamics was simulated for another 600 years, again using the *stack* function. A control simulation was also conducted (with no disturbance). Taxonomic and functional diversity were assessed before and after disturbance using indices of species richness and functional diversity (FDiv, the volume of functional space occupied by the community; FEve, the regularity of the distribution of abundance within this volume; Villéger et al., 2008). We computed changes in above-ground biomass, basal area, total number of stems, number of stems larger than 10 cm and 30 cm DBH, from which we calculated a resilience index (see Schmitt et al., 2020). The *rcontrol* package reproduces the analyses of Schmitt et al. (2020) with only about 80 lines of R code, increasing transparency and replicability (Supplementary Information SI4 and SI5; Figure 4).

<figure><img src="image_7.png" /></figure>

**FIGURE 3** Sensitivity of TROLL to parameters using Morris analysis. Twelve parameters of TROLL were tested, with abbreviations found in Table 1. The level of grey of the label indicates parameters related to the same processes (from dark grey to white, respectively: carbon allocation, crown allometry, leaf ecophysiology, mortality and reproduction). The x-axis represents the absolute mean of elementary effect $\mu^*$, and the y-axis represents the variance of elementary effect $\sigma$. A high $\mu^*$ indicates a factor with a heavy overall influence on model outputs; a high $\sigma$ indicates heterogeneity of the sensitivity across the parameter space, which could indicate nonlinearities or interactions with other parameters. A high $\mu^*$ also tends to produce high $\sigma$, so $\sigma$ should be interpreted relative to the ratio $\sigma/\mu^*$. The three lines dividing the space provide the type of relation of the focal parameter with other studied parameters.
**FIGURE 4** Trajectories of simulated above-ground biomass (AGB, Mg/ha) over time (year) for one community (with 20 species). The colours of the lines represent the types of trajectories, with the trajectory of the predisturbance simulation from bare soil in black, the trajectory after the disturbance event in red and the trajectory of the undisturbed control simulation from the mature state before disturbance in green.

<figure><img src="image_8.png" /></figure>

4 | DISCUSSION

The R package *rcontroll* is a wrapper for the *TROLL* individual-based forest simulator. The main goal is to increase the accessibility of the C++-coded model and to make it available to a wider community of researchers and students by facilitating the setting up and running of simulations. *rcontroll* also provides the community with tools to quickly analyse the outputs of *TROLL* in a standardised way. *rcontroll* is intended to facilitate research on complex issues in forest ecology and provide new use cases. This new wrapper of *TROLL* will also help increase transparency and reproducibility in simulation experiments.

We have provided two concrete use cases. In the first, *rcontroll* is used to perform a simulation-intensive sensitivity analysis of 12 parameters of the *TROLL* model, providing both a better understanding of the model's behaviour and uncertainties and opportunities for efficient model transferability with calibration across sites. In the second, we showed how *rcontroll* facilitates the replication of a previously published analysis (Schmitt et al., 2020) by simplifying the code while increasing transparency and reproducibility. The reproducibility of studies can be further increased by the use of other R packages, such as *tidyverse* (Wickham et al., 2019) essential for processing simulation results, analyses and graphs. *rcontroll* can be used to address a wide range of topical fundamental and applied ecological questions by means of modeling, such as the assessment of management scenarios (Marechaux et al., 2020).

The *rcontroll* package is tightly linked to *TROLL*, so a specific discussion of the latter is in order here. As with any model, *TROLL* is built upon assumptions and care should be taken to interpret its results carefully. We strongly recommend that users apply the model within its current range of application and discuss their results by taking into account the limitations of *TROLL* discussed in Maréchaux and Chave (2017) and Rau et al. (2022). *TROLL* has been developed and used for natural tropical forests. Although it is intended to be widely applicable and has been successfully extended to the subtropics (Rau et al., 2022), certain assumptions need to be critically examined when applying it outside the tropics. Some assumptions and limitations may change with *TROLL* versions (3.1.7 at the time of this manuscript), so users are encouraged to check future *TROLL* upgrades. Feedback on the *TROLL* model is

welcome by the development team (JC, IM and FJF). As *TROLL* is being further developed, we plan to upgrade *rcontroll* concurrently with *TROLL* and to swiftly include any major new development. *rcontroll* includes a helper function that keeps track of the corresponding *TROLL* version (*TROLL.version* function). In future, we also plan to add a global user interface in shiny for *rcontroll* (e.g. Schmitt et al., 2017), to increase its user-friendliness, as well as the Canopy Constructor model (Fischer et al., 2020), which could be used to run simulations from empirical forest inventories. Finally, we aim to increase the interoperability of *rcontroll* with the rest of the R ecosystem by providing formatting functions that would make it easy to import forest inventories from existing repositories or models and to easily export simulation outputs to other tools designed for their analysis.

The *rcontroll* package is free and open source (version 0.1.0 with GPL3). It is available on the CRAN repository https://cran.r-project.org/web/packages/rcontroll/index.html and can be installed in the R environment using the *install.packages('rcontroll')* command. The project is hosted on GitHub (https://github.com/sylvainschmitt/rcontroll), which allows future users to openly contribute to the project.

AUTHOR CONTRIBUTIONS

Sylvain Schmitt and Guillaume Salzet conceived the ideas; Sylvain Schmitt led the package development; Sylvain Schmitt and Guillaume Salzet designed the examples and analysed model outputs; and Sylvain Schmitt led the writing of the manuscript. All authors contributed critically to the drafts and gave final approval for publication.

ACKNOWLEDGEMENTS

This work was supported by the ‘Amazonian Landscapes in Transition’ project and by the ‘Investissement d’Avenir’ grants (CEBA, ref. ANR-10-LABX-25-01; TULIP, ref. ANR-10-LABX-0041; ANAEE-France: ANR-11-INBS-0001), all managed by the Agence Nationale de la Recherche, by CNES (BIOMASS-VALO TOSCA Project), and the LECOS Project funded by the INRAE-CNRS joint initiative.

CONFLICT OF INTEREST STATEMENT

No conflict of interest.
## PEER REVIEW

The peer review history for this article is available at https://www.webofscience.com/api/gateway/wos/peer-review/10.1111/2041-210X.14215.

## DATA AVAILABILITY STATEMENT

All data are available on Zenodo (Schmitt et al., 2023).

## ORCID

Sylvain Schmitt https://orcid.org/0000-0001-7759-7106

Guillaume Salzet https://orcid.org/0000-0003-4548-5673

Fabian Jörg Fischer https://orcid.org/0000-0003-2325-9886

Isabelle Maréchaux https://orcid.org/0000-0002-5401-0197

Jerome Chave https://orcid.org/0000-0002-7766-1347

## REFERENCES

Atkin, O. K., Bloomfield, K. J., Reich, P. B., Tjoelker, M. G., Asner, G. P., Bonal, D., Bönisch, G., Bradford, M. G., Cernusak, L. A., Cosio, E. G., Creek, D., Crous, K. Y., Domingues, T. F., Dukes, J. S., Egerton, J. J., Evans, J. R., Farquhar, G. D., Fyllas, N. M., Gauthier, P. P., ... Zaragoza-Castells, J. (2015). Global variability in leaf respiration in relation to climate, plant functional types and leaf traits. *New Phytologist*, 206(2), 614–636. https://doi.org/10.1111/nph.13253

Binois, M., & Gramacy, R. B. (2021). HetGP: Heteroskedastic gaussian process modelling and sequential design in R. *Journal of Statistical Software*, 98(13), 1–44. https://doi.org/10.18637/jss.v09.i13

Chalom, A., & Prado, P. I. (2017). *pse: Parameter space exploration with Latin Hypercubes* (0.4.7) [R; R package]. https://github.com/andre chalom/pse

Chave, J. (1999). Study of structural, successional and spatial patterns in tropical rain forests using TROLL, a spatially explicit forest model. *Ecological Modelling*, 124(2–3), 233–254. https://doi.org/10.1016/S0304-3800(99)00171-4

Curtis, P. G., Slay, C. M., Harris, N. L., Tyukavina, A., & Hansen, M. C. (2018). Classifying drivers of global forest loss. *Science*, 361(6407), 1108–1111. https://doi.org/10.1126/science.aau3445

Domingues, T. F., Meir, P., Feldpausch, T. R., Saiz, G., Veenendaal, E. M., Schrodt, F., Bird, M., Djagbletey, G., Hien, F., Compaore, H., Diallo, A., Grace, J., & Lloyd, J. (2010). Co-limitation of photosynthetic capacity by nitrogen and phosphorus in West Africa woodlands. *Plant, Cell and Environment*, 33(6), 959–980. https://doi.org/10.1111/j.1365-3040.2010.02119.x

Eddelbuettel, D., & François, R. (2011). Rcpp: Seamless R and C++ integration. *Journal of Statistical Software*, 40(8), 1–18. https://doi.org/10.18637/JSS.V040.I08

Ek, A. R., & Monserud, R. A. (1974). FOREST: A computer model for simulating the growth and reproduction of mixed species forest stands. Research Report, School of Natural Resources. College of Agricultural and Life Sciences, University of Wisconsin.

Falster, D. S., FitzJohn, R. G., Brännström, Å., Dieckmann, U., & Westoby, M. (2016). plant: A package for modelling forest trait ecology and evolution. *Methods in Ecology and Evolution*, 7(2), 136–146. https://doi.org/10.1111/2041-210X.12525

Farquhar, G. D., von Caemmerer, S., & Berry, J. A. (1980). A biochemical model of photosynthetic CO₂ assimilation in leaves of C3 species. *Planta*, 149(1), 78–90. https://doi.org/10.1007/BF00386231

Fischer, F. J. (2019). Inferring the structure and dynamics of tropical rain forests with individual-based forest growth models (Doctoral dissertation). Université Paul Sabatier-Toulouse III.

Fischer, F. J., Labrière, N., Vincent, G., Hérault, B., Alonso, A., Memiaghe, H., Bissiengou, P., Kenfack, D., Saatchi, S., & Chave, J. (2020).

A simulation method to infer tree allometry and forest structure from airborne laser scanning and forest inventories. *Remote Sensing of Environment*, 251, 112056. https://doi.org/10.1016/j.rse.2020.112056

Fischer, F. J., Maréchaux, I., & Chave, J. (2019). Improving plant allometry by fusing forest models and remote sensing. *New Phytologist*, 223, 1159–1165. https://doi.org/10.1111/nph.15810

Fischer, R., Ensslin, A., Rutten, G., Fischer, M., Costa, D. S., Kleyer, M., Hemp, A., Paulick, S., & Huth, A. (2015). Simulating carbon stocks and fluxes of an African tropical montane Forest with an individual-based forest model. *PLoS ONE*, 10(4), e0123300. https://doi.org/10.1371/JOURNAL.PONE.0123300

Fisher, R. A., Koven, C. D., Anderegg, W. R. L., Christoffersen, B. O., Dietze, M. C., Farrier, C. E., Holm, J. A., Hurtt, G. C., Knox, R. G., Lawrence, P. J., Lichstein, J. W., Longo, M., Matheny, A. M., Medvigy, D., Muller-Landau, H. C., Powell, T. L., Serbin, S. P., Sato, H., Shuman, J. K., ... Moorcroft, P. R. (2018). Vegetation demographics in earth system models: A review of progress and priorities. *Global Change Biology*, 24, 35–54. https://doi.org/10.1111/gcb.13910

Fyllas, N. M., Bentley, L. P., Shenkin, A., Asner, G. P., Atkin, O. K., Díaz, S., Enquist, B. J., Farfan-Rios, W., Gloor, E., Guerrieri, R., Huasco, W. H., Ishida, Y., Martin, R. E., Meir, P., Phillips, O., Salinas, N., Silman, M., Weerasinghe, L. K., Zaragoza-Castells, J., & Malhi, Y. (2017). Solar radiation and functional traits explain the decline of forest primary productivity along a tropical elevation gradient. *Ecology Letters*, 20(6), 730–740. https://doi.org/10.1111/ELE.12771

Gourlet-Fleury, S., Guehl, J.-M., Laroussinie, O., & ECOFOR (Group) (Eds.). (2004). *Ecology and management of a neotropical rainforest: Lessons drawn from Paracou, a long-term experimental research site in French Guiana*. Elsevier.

Hubau, W., Lewis, S. L., Phillips, O. L., Affum-Baffoe, K., Beeckman, H., Cuní-Sanchez, A., Daniels, A. K., Ewango, C. E. N., Fauset, S., Mukinzi, J. M., Sheil, D., Sonké, B., Sullivan, M. J. P., Sunderland, T. C. H., Taedoumg, H., Thomas, S. C., White, L. J. T., Abernethy, K. A., Adu-Bredu, S., ... Zemagho, L. (2020). Asynchronous carbon sink saturation in african and Amazonian tropical forests. *Nature*, 579, 80–87. https://doi.org/10.1038/s41586-020-2035-0

Huntington, D. E., & Lyrintzis, C. S. (1998). Improvements to and limitations of Latin hypercube sampling. *Probabilistic Engineering Mechanics*, 13(4), 245–253. https://doi.org/10.1016/S0266-8920(97)00013-1

Kazmierczak, M., Wiegand, T., & Huth, A. (2014). A neutral vs. non-neutral parametrizations of a physiological forest gap model. *Ecological Modelling*, 288, 94–102. https://doi.org/10.1016/j.ecolmodel.2014.05.002

Knapp, N., Fischer, R., & Huth, A. (2018). Linking lidar and forest modeling to assess biomass estimation across scales and disturbance states. *Remote Sensing of Environment*, 205, 199–209. https://doi.org/10.1016/J.RSE.2017.11.018

Köhler, P., & Huth, A. (1998). The effects of tree species grouping in tropical rainforest modelling: Simulations with the individual-based model FORMIND. *Ecological Modelling*, 109(3), 301–321. https://doi.org/10.1016/S0304-3800(98)00066-0

Levin, S. A. (1998). Ecosystems and the biosphere as complex adaptive systems. *Ecosystems*, 1(5), 431–436. https://doi.org/10.1007/S100219900037/METRICS

Maréchaux, I., & Chave, J. (2017). An individual-based forest model to jointly simulate carbon and tree diversity in Amazonia: Description and applications. *Ecological Monographs*, 87(4), 632–664. https://doi.org/10.1002/ecm.1271

Marechaux, I., Langerwisch, F., Huth, A., Bugmann, H., Reyer, C., Seidl, R., Collalti, A., Paula, M. D. D., Fischer, R., Gutsch, M., co-lexer, M. J., & Lischke, H. (2020). Tackling unresolved questions in forest ecology: The past and future role of simulation models. *Ecology and Evolution*, 1–35. https://doi.org/10.1002/ece3.7391
Medlyn, B. E., Duursma, R. A., Eamus, D., Ellsworth, D. S., Prentice, I. C., Barton, C. V. M., Crous, K. Y., Angelis, P. D., Freeman, M., & Wingate, L. (2011). Reconciling the optimal and empirical approaches to modelling stomatal conductance. *Global Change Biology*, 17, 2134–2144. http://doi.wiley.com/10.1111/j.1365-2486.2010.02375.x

Morin, X., Fahse, L., de Mazancourt, C., Scherer-Lorenzen, M., & Bugmann, H. (2014). Temporal stability in forest productivity increases with tree diversity due to asynchrony in species dynamics. *Ecology Letters*, 17(12), 1526–1535. https://doi.org/10.1111/ele.12357

Morris, M. D. (1991). Factorial sampling plans for preliminary computational experiments. *Technometrics*, 33(2), 161–174. https://doi.org/10.1080/00401706.1991.10484804

Muñoz-Sabater, J., Dutra, E., Agustí-Panareda, A., Albergel, C., Arduini, G., Balsamo, G., Boussetta, S., Choulga, M., Harrigan, S., Hersbach, H., Martens, B., Miralles, D. G., Piles, M., Rodríguez-Fernández, N. J., Zsoter, E., Buontempo, C., & Thépaut, J. N. (2021). ERA5-land: A state-of-the-art global reanalysis dataset for land applications. *Earth System Science Data*, 13, 4349–4383. https://doi.org/10.5194/essd-13-4349-2021

Phillips, S. J., Anderson, R. P., & Schapire, R. E. (2006). Maximum entropy modeling of species geographic distributions. *Ecological Modelling*, 190(3–4), 231–259. https://doi.org/10.1016/j.ecolmodel.2005.03.026

Purves, D., & Pacala, S. (2008). Predictive models of forest dynamics. *Science*, 320(5882), 1452–1453. https://doi.org/10.1126/science.1155359

Rau, E.-P., Fischer, F., Joetzjer, É., Maréchaux, I., Sun, I. F., & Chave, J. (2022). Transferability of an individual- and trait-based forest dynamics model: A test case across the tropics. *Ecological Modelling*, 463(June 2021), 109801. https://doi.org/10.1016/j.ecolmodel.2021.109801

Rödig, E., Cuntz, M., Rammig, A., Fischer, R., Taubert, F., & Huth, A. (2018). The importance of forest structure for carbon fluxes of the Amazon rainforest. *Environmental Research Letters*, 13(5), 054013. https://doi.org/10.1088/1748-9326/aabc61

Rödig, E., Huth, A., Bohn, F., Rebmann, C., & Cuntz, M. (2017). Estimating the carbon fluxes of forests with an individual-based forest model. *Forest Ecosystems*, 4(1), 1–10. https://doi.org/10.1186/s40663-017-0091-1

Roussel, J. R., Auty, D., Coops, N. C., Tompalski, P., Goodbody, T. R. H., Meador, A. S., Bourdon, J. F., de Boissieu, F., & Achim, A. (2020). lidR: An r package for analysis of airborne laser scanning (ALS) data. *Remote Sensing of Environment*, 251, 112061. https://doi.org/10.1016/j.rse.2020.112061

Saatchi, S., Asefi-Najafabady, S., Malhi, Y., Aragão, L. E. O. C., Anderson, L. O., Myneni, R. B., & Nemani, R. (2013). Persistent effects of a severe drought on Amazonian forest canopy. *Proceedings of the National Academy of Sciences of the United States of America*, 110(2), 565–570. https://doi.org/10.1073/pnas.1204651110

Sakschewski, B., von Bloh, W., Boit, A., Poorter, L., Peña-Claros, M., Heinke, J., Joshi, J., & Thonicke, K. (2016). Resilience of Amazon forests emerges from plant trait diversity. *Nature Climate Change*, 6(11), 1032–1036. https://doi.org/10.1038/nclimate3109

Schmitt, S., Maréchaux, I., Chave, J., Fischer, F. J., Piponiot, C., Traissac, S., & Hérault, B. (2020). Functional diversity improves tropical forest resilience: Insights from a long-term virtual experiment. *Journal of Ecology*, 108(3), 831–843. https://doi.org/10.1111/1365-2745.13320

Schmitt, S., Pouteau, R., Justeau, D., de Boissieu, F., & Birnbaum, P. (2017, December 1). ssdm: An r package to predict distribution of species richness and composition based on stacked species distribution

models. *Methods in Ecology and Evolution*, 8, 1795–1803. https://doi.org/10.1111/2041-210X.12841

Schmitt, S., Salzet, G., Fischer, F. J., Maréchaux, I., & Chave, J. (2023). sylvainschmitt/rcontroll: v0.1.0. Zenodo. https://doi.org/10.5281/zenodo.7635666

Shugart, H. H. (1984). *A theory of forest dynamics. The ecological implications of forest succession models*. A Theory of Forest Dynamics, The Ecological Implications of Forest Succession Models.

Shugart, H. H., Asner, G. P., Fischer, R., Huth, A., Knapp, N., le Toan, T., & Shuman, J. K. (2015). Computer and remote-sensing infrastructure to enhance large-scale testing of individual-based forest models. *Frontiers in Ecology and the Environment*, 13(9), 503–511. https://doi.org/10.1890/140327

Shugart, H. H., Wang, B., Fischer, R., Ma, J., Fang, J., Yan, X., Huth, A., & Armstrong, A. H. (2018). Gap models and their individual-based relatives in the assessment of the consequences of global change. *Environmental Research Letters*, 13, 033001. https://doi.org/10.1088/1748-9326/aaaacc

Shugart, H. H., & West, D. C. (1980). Forest Succession Models. *Bioscience*, 30(5), 308–313. https://doi.org/10.2307/1307854

Urban, D. L., Bonan, G. B., Smith, T. M., & Shugart, H. H. (1991). Spatial applications of gap models. *Forest Ecology and Management*, 42(1-2), 95–110. https://doi.org/10.1016/0378-1127(91)90067-6

Villéger, S., Mason, N. W. H., & Mouillot, D. (2008). New multidimensional functional diversity indices for a multifaceted framework in functional ecology. *Ecology*, 89(8), 2290–2301. https://doi.org/10.1890/07-1206.1

Wickham, H., Averick, M., Bryan, J., Chang, W., McGowan, L., François, R., Grolemund, G., Hayes, A., Henry, L., Hester, J., Kuhn, M., Pedersen, T., Miller, E., Bache, S., Müller, K., Ooms, J., Robinson, D., Seidel, D., Spinu, V., ... Yutani, H. (2019). Welcome to the tidyverse. *Journal of Open Source Software*, 4, 1686. https://doi.org/10.21105/joss.01686

## SUPPORTING INFORMATION

Additional supporting information can be found online in the Supporting Information section at the end of this article.

**Supporting Information S1-S6:** Supporting information SI1 describes the climate generation function. Supporting information SI2 further detail the sensitivity analysis of TROLL parameters with reproducible code in SI3 and supporting functions in SI6. Supporting information SI4 further detail the analysis of functional diversity on forest resilience with reproducible code in SI5.

**How to cite this article:** Schmitt, S., Salzet, G., Fischer, F. J., Maréchaux, I., & Chave, J. (2023). *rcontroll*: An R interface for the individual-based forest dynamics simulator *TROLL*. *Methods in Ecology and Evolution*, 00, 1–9. https://doi.org/10.1111/2041-210X.14215