Landscape context importance for predicting forest transition success in central Panama

Naturally recovering secondary forests are frequently re-cleared before they can recover to pre-disturbance conditions. Identifying landscape factors associated with persistence success will help planning cost-efficient and effective forest restoration. The ability of secondary forest to persist is an often undervalued requisite for long-term ecosystem restoration. Here we identify the landscape context for naturally regenerated forests to persist through time within central Panama. We developed a random forest classification (RFC) calibration method to identify areas with high (≥ 90%) and low (< 90%) likelihood of forest persistence success based on their spatial relation with nine landscape explanatory variables. The RFC model discriminated between secondary forests areas that persisted and did not persisted with an error rate of 2%. By tuning, we obtained a precision of 0.94 (94%) in the validation test. The two most important explanatory variables involved in the persistence dynamic were elevation and distance to the nearest rural area. Naturally regenerated forests lasted longer in patches that were closer to both Gatun and Alajuela Lakes as to protected areas, but further from rural communities, roads, urban areas and in patches with higher elevation and steeper slopes. By tracking remote sensed, landscape context metrics of easy collection, we developed a prediction map of central Panama areas with high (≥ 90%) and low (> 90%) probability of natural forest regeneration and persistence success within the next 30 years. This map represents a basis for management decisions and future investigations for effective, long-term forest-landscape restoration.


Introduction
Protecting and restoring forests is essential to meeting the Paris Climate Agreement and the new Global Biodiversity Framework goals, conserving biodiversity, and addressing food security and livelihood needs (Chazdon et al. 2017a;UN SDG 2017;Lewis et al. 2019;CBD 2022). Many reforestation activities are being conducted worldwide, at both local and landscape scales. While local-based projects could help determine the best specific solution for the target area, landscape-scale projects require a broader perspective and planning for restoration activities (Mansourian and Vallauri 2014). The forest landscape restoration (FLR) is a holistic approach that considers the relationship between landscape structure (the spatial patterning of different land uses across space) and landscape functioning (ecological processes), and holds promises to achieve both ecological and social goals. It also provides long-term, multi-objective and large-scale means to implement international targets in field interventions (Turner 2005;Hall et al. 2011Hall et al. , 2015Holl 2017;Stanturf and Mansourian 2020). Within the different forest recovery scenarios, natural recovery, or "passive restoration" sensu Holl and Aide (2011), can play a major role in large-scale landscape restoration in tropical regions (van Breugel et al. 2013a, b;Chazdon and Guariguata 2016;Chazdon and Uriarte 2016;Hall et al. 2022).
Significant progress in recovering ecosystem services found in mature tropical forests have been observed in as little as two decades of naturally recovering secondary forests. For example, Martin et al. (2013) found aboveground carbon pools can recover to xxxx in yyy time while Rozendaal et al. (2019) reported an 80% recovery of tree species diversity in 20 years across the Neotropics. Poorter et al. (2021) found significant recovery of functional traits within this same time period for a sub sample of these same sites. Working at Agua Salud in Panama on water related ecosystem services, Hassler et al. (2011) found a significant recovery in saturated hydraulic conductivity, a measure of soil water infiltration in 12 to 15 years of natural forest recovery in the top layer of the mineral soils. Birch et al. (2021) reported recovery of hydraulic flow paths at the catchment scale at Agua Salud up to 30 cm depth within a decade of forest recovery while Chavarria et al. (2021) report a significant shift in stream water bacterial communities and measures of water quality at the same site and time scale. This means that to achieve an effective restoration of forest landscape, forests not only need suitable conditions to grow, but also to persist in time (Sloan 2022), where persistence is defined as a time-dependent process where forests grow, mature and continue to be present in time, without being cut again. Persistence of naturally regenerating forests could translate into a "forest transition" event, which has been increasingly observed in the tropics since the 1990s (e.g., Rudel et al. 2002;Aide et al. 2013;Sloan 2022). Several studies have found that newly recovered forests are frequently re-cleared before they can recover to pre-disturbance conditions (Breugel et al. 2013a, b;Mbow et al. 2017;Meli et al. 2017;Brondizio et al. 2019;Reid et al. 2019). Detecting this dynamic and identifying the context where naturally recovered forest do not persist could provide support for a more effective forest landscape restoration planning (Smith et al. 2003;Fagan et al. 2013;Sloan 2016;Reid et al. 2017;Schwartz et al. 2017Schwartz et al. , 2020Borda-Niño et al. 2020). To our knowledge, no studies have yet provided spatially explicit insights and/or landscape attributes related to the persistance of naturally recovering secondary forests in central Panama.
Central Panama is a dynamic and heterogeneous area with a diversity of ecosystems and habitats in a relatively small area, including tropical lowland and pre-montane moist forests, freshwater wetlands, and mangroves (Holdridge et al. 1967;Ibanez et al. 2002), where its provision and dependence on ecosystem services are well known. The region hosts one of the most important inland commercial waterways, the Panama Canal, which is important for international trade and a crucial economic driver for the country (Adamowicz et al. 2019). It contains two large artificial freshwater lakes-Gatun Lake and Alhajuela Lake-both created to ensure canal operations and freshwater supply for Panama City, the city of Colon, and numerous towns in between (Hall et al. 2015). The long-term maintenance and sustainability of central Panama biodiversity and water supply depends on the preservation of the tropical forest cover; the latter is accomplished in part through a system of 21 protected and/or restricted areas (see, e.g. Hall et al. 2022). Nevertheless, it has experienced rapid economic growth over the past decade, followed by intense land use/land-cover changes (Heckadon Moreno at al. 1999;Condit et al. 2001;Ibanez et al. 2002;Walker et al. 2020) which led to the construction of roadways and the expansion of pastures. This has stimulated the decrease of forest cover capable of regulating water supply and maintaining connectivity between the protected areas (Rompre et al. 2008).
As people have migrated to cities in central Panama to take advantage of economic opportunities found there, significant areas that had been cleared for agriculture have regenerated (Wright and Samaniego 2008;Sloan 2015) and also reduced the rate of deforestation by over 80% in recent decades (Walker 2020; Hall et al. 2022). It is therefore an area where the recovery and the conservation of forests is key to support ecosystem services supply and where it is crucial to assess wether and how the natural expansion of secondary forests is allowed to establish into forest transition. Yet, we do not know how much of the naturally recovered secondary forests persisted longer than 20 years, much less the relationship between landscape attributes and the probability to persist.
In this paper, we aim to identify the landscape context for naturally recovered forest to persist in time within central Panama. We studied the forest areas that naturally recovered in the two decades between 1990 and 2010 and persisted until 2020 using the random forest classification (RFC) method and relying on the tuning of important RFC parameters, to identify areas with higher likelihood of persistence success.

Study area
Our study area is identical to that of Hall et al. (2022) and represents 23% of the country's land area (Fig. 1). The study area includes the Panama Canal Watershed (PCW), an area of critical relevance for biodiversity conservation and economic development (Ibanez et al. 2002;Adamowicz et al. 2019). Previous projections of deforestation and carbon storage have found that the unrealistic scenario of halting deforestation and allowing all available forested land within the study region to be protected, to grow, and to persist, central Panama could sequester between 56.0% of its national goal. In contrast, were deforestation rates to revert to those before the year 2000, it would have devastating consequences releasing an additional 73 million Mg CO2e by 2050, making it extremely difficult for Panama to achieve its planned land-based carbon sequestration objective (Hall et al. 2022).
Data processing and quantification of persistence A unique 30-year time-series data set  of central Panama vegetation cover compiled by Walker (2020) was used to identify areas where natural regeneration occurred spontaneously and persisted between 1990 and 2020 ( Fig. 2a-c). Vegetation cover layers were based on epochal composite of dry-season Landsat 4, 5, 7, 8 images with less than 70% total cloud cover and at least 10% clear pixels images (30 m). All images were downloaded as Landsat Surface Reflectance Products through the EROS science processing architecture (ESPA) interface with standard pre-processing for L1T data to correct for positional and atmospheric conditions and handclassified in five macro-categories and 23 sub-categories (Table 1). Sub-categories provide additional information regarding habitat, disturbance and landuse, allowing for a better understanding of land-cover change dynamics. Unlike previous land-cover maps of Panama, which applied dichotomous or categorical definitions of forests, these maps are based on an ordinal scale to define vegetation, distinguishing different age classes of secondary forests: low vegetation (1-2 yrs), medium vegetation (3-5 yrs), high vegetation (6-20 yrs) and forest (≥ 20 yrs), and therefore capturing small and ephemeral clearings. Such gradient reflects the natural process of regeneration and acknowledges the fuzzy boundaries between forest and non-forest classes. The Walker forest cover and forest-cover change maps were designed to achieve an adequate spatial and temporal resolution; before these maps became available Panama lacked a consistent dataset by which to assess baselines for land-cover changes.
The regeneration and persistence dynamics were observed working at macro-categories level (NOVEG, LOWVEG, MEDVEG, HIGHVEG and FOREST), while the pre-selection of eligible patches also considered sub-categories. We adopted a patchbased approach, where a patch is defined as a minimum 0.5 ha width, homogeneous area that differs from its surroundings (Forman and Godron 1981;Farina 2000). The patches classified as HIGHVEG in 1990 were excluded from the dataset to limit the fuzziness and highlight the transition from nonforest to forest. The patches classified as NOVEG, as LOWVEG sub-categories low crops rainfed (18) and low crops irrigated (28), and as MEDVEG sub-category high crops (48) were not considered in the analysis as our goal was to assess the forestlandscape natural regeneration potential in a multifunctional landscape, without altering the presence of urban/agricultural land-uses. Finally, we excluded the patches classified as FOREST sub-category evergreen plantations (68) to focus on natural regeneration only. We designated patches with 0 = natural recovery BUT NO persistence or 1 = natural recovery AND persistence histories as follows: Patches 0 were identified as ≥ 0.5 ha patches classified as LOWVEG or MEDVEG in 1990, as FOREST in 2010 and again as LOWVEG or MEDVEG in 2020 land-cover map; patches 1 were identified as ≥ 0.5 ha patches classified as LOWVEG or MEDVEG in 1990 land cover map and as FOREST in both subsequent 2010 and 2020 land cover maps, for at least 50% of their total area. Our sample was composed by 1,234 patches ranging from 0.5 to 35,978 ha, representing a total area of 150,381 ha.

Explanatory variables
While climatic and edaphic factors affect plant germination, growth, and survival, leading variations in the regeneration process across regions, landscape context determines where regeneration is permitted to occur and persist, playing a central role in driving successional pathways within human-modified landscapes, such as tropical ones (Jakovac et al. 2021). Nine remote-sensed, easily collectable explanatory variables linked to anthropic use and access of the area were measured for each of the 1234 patches included in the dataset (Table 2): mean patch elevation (meanElev); mean patch slope (meanSlope); minimum distance from the patch centroid to the nearest road (RoadsDista); minimum distance from the patch centroid to the nearest river (Hydro123D); minimum distance from the patch centroid to the nearest urban area (UrbanDista), defined by the National Institute of Statistics and Census of Panama as the populated places that concentrates 1500 or more inhabitants; minimum distance from the centroid to the nearest rural area (RuralDist), defined by the National Institute of Statistics and Census of Panama as the populated places that concentrates > 1500 inhabitants; minimum distance from the patch centroid to either Gatun or Alajuela lake (LLDistDi); minimum distance from the patch centroid to the nearest protected area (PADistanc); mean distance between the centroid and the patch's edge (distpole). The selection of explanatory variables was based on a previous study on deforestation scenarios and future carbon dynamics conducted in the PCW (Hall et al. 2022). The variable distpole, which was not used in the previous study, was included to consider the patch nature of our samples and their variability in terms of extent..

Random forest classification
We evaluated the associations between secondary forest persistence success and landscape-context predictors using the Machine-Learning (ML) based method of random forest classification (RFC) (Breiman 2001). The advantage of ML over traditional statistical techniques is the ability to model highly dimensional and non-linear data-such as ecological data (Knudby et al. 2010;Thessen 2016)-with complex interactions. There are several types of tasks that ML techniques can perform. The task we were interested in was the classification, the process of predicting the class of given data point (Kotsiantis 2007). RFC is the most widespread classifier ML technique, especially when working with land use/land cover change  Talukdar et al. 2020). RFC is a supervised algorithm based on decision trees and improved bagging and bootstrap techniques that utilizes several classifiers to work together to identify the class label for each observation (Yang et al. 2010). In addition, RFC provides variable importance measures, which can be used to identify most relevant features and/or their effect (Archer and Kimes 2008). However, like most classifiers RFC faces problems when learning from an extremely unbalanced training data set (Zakariah 2014). As it is constructed to minimize the overall error rate, it will tend to focus more on the prediction accuracy of the majority class, which often results in poor accuracy for the minority class. However, there are several techniques that can be used with RFC to solve class imbalance problems (Chen 2004;Kuhn and Johnson 2013;More and Rana 2017). We solved the class unbalance problems to the training set, and we validated the model on the unbalanced test set to assess the performance of the model with real frequencies. The study used the randomForest package running in Rstudio (CRAN) (Liaw and Wiener 2002).
Training dataset balancing The dataset was composed of 0 = 182 and 1 = 1052 units. We divided the dataset into training and test sets following the rule of 70-30%, as it is demonstrated to represent the ratio with the best performance in ML models (Nguyen et al. 2021). The balance problem was solved for the training set through up-sampling technique (upSample function in the caret package running in Rstudio (CRAN)). Up-sampling is an oversampling technique that randomly selects and duplicates observations in the minority class to balance the dataset. We obtained a balanced training set with a total of 1474 samples. The optimal number of decision trees (n = 1000) and number of explanatory variables randomly sampled as candidates at each split (n = 3) were evaluated based on the lowest out of bag (OOB) error. The RFC is trained through bagging technique, where each new decision tree is fit from a subsample of the training units. The OOB error is the average classification error of the remaining training units not included in the subsample. That allows to fit and also validate the RFC while being trained (Breiman 1996).
Tuning The tuning consists of the identification of a set of optimal RFC hyperparameters' values to maximize the model's performance and produce better outputs. Hyperparameters are parameters whose values control the learning process of the model and can be tuned to increase some specific metrics like accuracy or precision. In our case, the RFC model was validated on an unbalanced test set to assess the real frequencies of 0 and 1 found in the PCW, within the past 30 years. Since RFC is designed to minimize the overall error rate, with an unbalanced dataset it will tend to focus more on the prediction accuracy of the majority class, which often results in poor accuracy for the minority class. For this reason, accuracy was not a suitable measure for our model's performance. We instead focused on the tuning of precision for 1, and recall for 0 (Table 3a, b). Here precision is defined as the ability of a classifier not to label "as TRUE" an instance that is actually "FALSE". For each class, it is defined as the ratio of real trues (RT) to the sum of real trues and false trues (FT), Eq. (1): Thus, the precision measures how good the model is at predicting a specific category. The recall (also known as sensitivity) is the ability of a classifier to find all the RT instances for the specified class. It is defined as the ratio of RT to the sum of RT and false false (FF), Eq. (2): Recall is a measure of how many times the model was able to detect a specific category. To maximize the precision of 1, we needed to improve the Recall of 0. In other words, we needed to reduce as much as possible the misclassification errors (FT) of 0. A straightforward approach to improve the performance of a classifier that predicts probabilities with unbalanced dataset is to tune the threshold used to map probabilities to class labels. ML algorithms predicts the probability or scoring of class membership by using a threshold. All values equal to or greater than the selected threshold are mapped to one class and all the other values are mapped to another class. We therefore tested several thresholds until identifying 0.90 as the optimal one to improve the precision of 1 and recall of 0, as described above. Scores above 0.90 were classified as 1, those below as 0.
Tuning one of these quantities nevertheless entails a trade-off: as we increase the precision of a class, we decrease the recall for the same class, and viceversa. In our case, this trade-off leads to low sensitivity for class 1 (several 1 RT were lost), and consequently low precision for class 0 (a high percentage of the total patches that were predicted as 0, were actually 1).

Relative importance of independent variables and partial dependencies
To evaluate the specific behavior of each of the explanatory variables in the persistence dynamic we did not rely on the thresholds derived by the tree graph, rather on the relative importance of the independent variables and their partial dependencies. The underlying RFC algorithms are trained by randomly selected subsets of data, which makes thresholds potentially different for each of the "n" trees produced by the RFC, and therefore approximate for the purpose of our work. The relative importance of independent variables indicates their predictive power. It can be used to sort variable from most to least predictive, allowing to have more insights on the problem and to perform feature selection when there are too many input variables. The order of importance of the variables was measured through mean decrease

Random forest classification performance analysis
As shown in Table 4, in the training phase the RFC model discriminated between the two classes (0-1) with an OOB error rate of about 2% and a class specific error of 0.001 (0.1%) for the 0, and 0.046 (4.6%) for the 1. By tuning, Precision of 1 and Recall of 0 reached, respectively, 0.94 (94%) and 0.83 (83%) in the validation test (Table 5).

Relative importance of independent variables and partial dependencies plots
Variables are sorted and displayed in the Variable Importance plot (Fig. 3). The variables with more predictive power were meanElev and RuralDist, followed by LLDistDi, UrbanDist, meanSlope, PADistanc, RoadsDista, distpole and Hydro123D. Figure 4a-i shows the variables-specific partial dependencies plots, which represent how each variable marginally affected the persistence of secondary forests. The variables meanElev, meanSlope, RoadsDista, UrbanDist and RuralDist appeared to be directly proportional to the probability of 1, while distpole, PADistanc and LLDistDi were inversely proportional to the probability of 1.

Prediction map of secondary forests persistence
Based on the RFC model, we developed a prediction map of central Panama areas that have high (≥ 90%) and low (< 90%) probability of secondary forests persistence success within the next 20 years (Fig. 5). From a total of 286,593 ha of LOWVEG and MED-VEG present in 2020 within our study area, only 16% (~ 48,179 ha) have a probability ≥ 0.90% to recover and persist until, at least, 2050.

Discussion
Natural regeneration following land abandonment has been globally recorded starting from 1950 and is seen as an important opportunity for carbon sequestration and habitat restoration (Holl and Aide 2011; Chazdon   Hall et al. 2022). Yet, those benefits largely depend on the persistence of the forests, which has been found to be largely transient across the globe, with an average residence time of ~ 14.22 years (Crawford et al. 2022). Walker (2020) found significant secondary forest regeneration in central Panama. Our analysis, however, reveals that the secondary forest expansion recorded in the past 30 years did not necessarily persist. Indeed, 24% of the naturally regenerating secondary forest found in 2010 was lost by 2020. As pointed out by several authors, the potential ephemeral nature of secondary forests could result in a limited role for these forests in mitigating climate change and ecosystem service recovery. Piffer et al. (2022) found that the re-clearance of native secondary forests in the Atlantic Forests of Brazil greatly limited carbon sequestration, where second-growth forests could have sequestered over three times more carbon than the actual estimated carbon sequestration. Van Breugel et al. (2013a, b) noted that the proportion of species that could sustain reproductive populations (effective diversity) in a dynamic patchwork of young secondary forests found in central Panama depended on how old the secondary forests became and how many tree species were able to reach reproductive size within that time frame. By investigating the role of secondary forests in providing habitat for many vertebrates within tropical region, Acevedo-Charry et al. (2019) recorded slow recovery of species composition (at least 40 years) and strongly argued for the role of secondary forest persistence for the conservation of forest specialist's species as well as for source populations to recover in secondary forest sites. Identifying conditions that encourage the persistence of naturally regenerated forests is therefore crucial in assessing the real potential for ecosystem restoration within dynamic landscapes as those found in the tropics, as well as for informing evaluation of the specific supporting actions needed to reach the UN goals and to ensure a sustained ecosystem services provision. With a precision of 94%, we predicted areas with high (≥ 90%) and low (> 90%) probability of natural forest regeneration and persistence success within the next 30 years in central Panama (Fig. 5). These results demonstrate that a set of remotely sensed, easily collected landscape context variables could be used to predict persistence success of secondary forests. The two variables with more predictive power were found to be the elevation and the distance to rural areas. Naturally regenerated forests lasted longer in patches that were at higher elevation, further from rural communities, roads and urban areas, and on steeper slopes. This findings underlie the contribution of remoteness in achieving forest transition, mirroring what found in other areas within the tropics (Aide et al. 2013Molin et al. 2017;Calaboni et al. 2018;Reid et al. 2019). Ashton et al (2001) provided a framework for tropical forest restoration in Sri Lanka that is adaptable throughout the tropics (see, e.g., Griscom and Ashton 2011 for an example involving dry forest in Panama). They point out that the ability for forests to recover depends upon the level of degradation and the disturbance regime in terms of both chronicity and acuteness. More recently, Chazdon et al. (2021) commented on ecosystems recovery following damage or destruction. People can participate in enabling natural mechanisms of recovery of a targeted ecosystem by interventions that both facilitate the inherent capacity for natural recovery and inhibit drivers of ecosystem degradation. Our approach contributes to restoration planning by identifying areas where forests have higher and/or lower potential to persist in time, setting the scene for the identification of the stakeholders involved and the potential drivers of ecosystem degradation, allowing informed prioritization and planning of appropriate actions for the support of forest natural regeneration and its persistence in time. In addition, our approach allows for a more detailed future exploration of the social and economic drivers underlying the ephemerality of secondary forests within central Panama and represents a basis for future investigations and management decisions for successful, longterm forest-landscape restoration. Any errors are our own and should not tarnish the reputations of these esteemed persons.
Author contributions GB conceived of the presented idea; developed the theory; conceived, planned and conducted the data collection; wrote the manuscript. KW contributed with land cover maps. GB and GDF verified the analytical methods and performed the statistical analysis. MV contributed to writing correction. JSH contributed to improving the manuscript, supervised the findings of this work and encouraged GB to investigate on passive regeneration.
Funding Open access funding provided by Università degli Studi di Roma La Sapienza within the CRUI-CARE Agreement. The authors declare that no funds, grants, or other support were received during the preparation of this manuscript.

Declarations
Competing interest The authors have no relevant financial or non-financial interests to disclose. No authors have any conflict of interest associated with funders or any aspect of data collection.

Research involving in human and participants
This study did not collect human subject data, nor did it include the study of animals.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.