Title: | Methods to Analyse Seasonal Radial Tree Growth Data |
---|---|
Description: | Methods for comparing different regression algorithms for describing the temporal dynamics of secondary tree growth (xylem and phloem). Users can compare the accuracy of the most common fitting methods usually used to analyse xylem and phloem data, i.e., Gompertz function, Double Gompertz function, General Additive Models (GAMs); and an algorithm newly introduced to the field, i.e., Bayesian Regularised Neural Networks (brnn). The core function of the package is XPSgrowth(), while the results can be interpreted using implemented generic S3 methods, such as plot() and summary(). |
Authors: | Jernej Jevsenak [aut, cre] |
Maintainer: | Jernej Jevsenak <[email protected]> |
License: | GPL-3 |
Version: | 1.0.3 |
Built: | 2024-10-24 06:34:35 UTC |
Source: | CRAN |
A data set with dendrometer data from sugar maple and black spruce from Simoncouche site, Canada.
data_dendrometers
data_dendrometers
A data frame with 718 rows and 6 variables:
Simoncouche
sugar maple and black spruce
tree identifier
2017, 2020
day Of a Year
width expressed in relative terms
Data belongs to Sergio Rossi
A dataset with intra-seasonal radial tree growth data. It was collected in three different years, at three sites, each with six trees. Please see references for details.
data_trees
data_trees
A data frame with 945 rows and 7 variables:
XYLEM or PHLOEM
Fagus sylvatica (FASY), Picea abies (PIAB), Quercus pubescens (QUPE)
Panska reka (PAN), Karst (KRAS)
2011, 2017
Tree ID indicators ranging from 1 to 6
Day Of a Year
The total number of radial cells / the total ring width
Gričar, J., Prislan, P., De Luis, M., Gryc, V., Hacurová, J., Vavrčík, H., Čufar, K., 2015. Plasticity in variation of xylem and phloem cell characteristics of Norway spruce under different local conditions. Frontiers in plant science 6, 730. Gričar, J., Zavadlav, S., Jyske, T., Lavrič, M., Laakso, T., Hafner, P., Eler, K., Vodnik, D., 2019. Effect of soil water availability on intra-annual xylem and phloem formation and non-structural carbohydrate pools in stem of Quercus pubescens. Tree Physiol. 39, 222-233. Prislan, P., Gričar, J., Čufar, K., de Luis, M., Merela, M., Rossi, S., 2019. Growing season and radial growth predicted for Fagus sylvatica under climate change. Clim. Change 153, 181-197.
data frame with model fitting parameters for different regression methods.
parameters
parameters
A data frame with 79 rows and 2 variables:
XYLEM or PHLOEM
Fagus sylvatica (FASY), Picea abies (PIAB), Quercus pubescens (QUPE)
Panska reka (PAN), Karst (KRAS)
2011, 2017
Tree ID indicators ranging from 1 to 6
The initial value for the Gompertz parameter a
The initial value for the Gompertz parameter b
The initial value for the Gompertz parameter c
The number of neurons for BRNN method
The k parameter value for GAM method
The sp parameter value for GAM method
XylemPhloemSeasonalGrowth: This Function fits and compares the selected methods for modeling seasonal xylem and phloem data.
XPSgrowth( data_trees, parameters = NULL, search_initial_gom = FALSE, search_initial_double_gom = FALSE, fitting_method = c("gompertz", "GAM", "brnn"), ID_vars = NULL, fitted_save = FALSE, add_zeros = TRUE, add_zeros_before = "min", post_process = TRUE, unified_parameters = FALSE, gom_a = NA, gom_b = NA, gom_k = NA, d_gom_a1 = NA, d_gom_a2 = NA, d_gom_b1 = NA, d_gom_b2 = NA, d_gom_k1 = NA, d_gom_k2 = NA, brnn_neurons = NA, gam_k = NA, gam_sp = NA, gom_a_range = seq(0, 3000, by = 500), gom_b_range = seq(0.01, 1000, by = 50), gom_k_range = seq(0, 500, by = 2), d_gom_a1_range = seq(0, 1, by = 0.001), d_gom_a2_range = seq(0, 5, by = 0.01), d_gom_b1_range = seq(0, 5, by = 0.001), d_gom_b2_range = seq(0, 10, by = 0.1), d_gom_k1_range = seq(0, 1, by = 0.001), d_gom_k2_range = seq(0, 1, by = 0.001) )
XPSgrowth( data_trees, parameters = NULL, search_initial_gom = FALSE, search_initial_double_gom = FALSE, fitting_method = c("gompertz", "GAM", "brnn"), ID_vars = NULL, fitted_save = FALSE, add_zeros = TRUE, add_zeros_before = "min", post_process = TRUE, unified_parameters = FALSE, gom_a = NA, gom_b = NA, gom_k = NA, d_gom_a1 = NA, d_gom_a2 = NA, d_gom_b1 = NA, d_gom_b2 = NA, d_gom_k1 = NA, d_gom_k2 = NA, brnn_neurons = NA, gam_k = NA, gam_sp = NA, gom_a_range = seq(0, 3000, by = 500), gom_b_range = seq(0.01, 1000, by = 50), gom_k_range = seq(0, 500, by = 2), d_gom_a1_range = seq(0, 1, by = 0.001), d_gom_a2_range = seq(0, 5, by = 0.01), d_gom_b1_range = seq(0, 5, by = 0.001), d_gom_b2_range = seq(0, 10, by = 0.1), d_gom_k1_range = seq(0, 1, by = 0.001), d_gom_k2_range = seq(0, 1, by = 0.001) )
data_trees |
a data frame with ID variables and wood formation data with columns doy and width |
parameters |
a data frame with ID variables and initial parameter values for the selected methods |
search_initial_gom |
logical, should the algorithm to search initial Gompertz parameters be applied? This argument also overwrites manually defined Gompertz parameter values |
search_initial_double_gom |
logical, should the algorithm to search initial parameters for double Gompertz function be applied? This argument also overwrites manually defined parameter values for double Gompertz |
fitting_method |
vector of one or more methods to be compared: "gompertz", "double_gompertz", "gam", "brnn" |
ID_vars |
character vector of variables which indicate column names of ID variables |
fitted_save |
logical, should the fitted curves be saved in current working directory? |
add_zeros |
logical, should zero observations at the beginning of growing season be added? |
add_zeros_before |
if 'min' (character) then zeros will be added prior to the first observation in each year. Alternatively, users can specify absolute doy prior which zeros will be added. |
post_process |
logical, should the post-process algorithm be applied? |
unified_parameters |
logical, if TRUE, the algorithm will use only manually selected function parameters. See the arguments 'gom_a', 'gom_b', 'd_gom_k', 'd_gom_a1', 'd_gom_a2', 'd_gom_b1', 'd_gom_b2', 'd_gom_k1', 'd_gom_k2', 'brnn_neurons', 'gam_k' and 'gam_sp'. Default is FALSE |
gom_a |
numeric, the parameter a for the Gompertz function |
gom_b |
numeric, the parameter b for the Gompertz function |
gom_k |
numeric, the parameter k for the Gompertz function |
d_gom_a1 |
numeric, the parameter a1 for the double Gompertz function |
d_gom_a2 |
numeric, the parameter a2 for the double Gompertz function |
d_gom_b1 |
numeric, the parameter b1 for the double Gompertz function |
d_gom_b2 |
numeric, the parameter b2 for the double Gompertz function |
d_gom_k1 |
numeric, the parameter k1 for the double Gompertz function |
d_gom_k2 |
numeric, the parameter k2 for the double Gompertz function |
brnn_neurons |
positive integer, the number of neurons to be used by the BRNN method |
gam_k |
numeric, the parameter k for General Additive Model (GAM) |
gam_sp |
numeric, the parameter sp for General Additive Model (GAM) |
gom_a_range |
a numerical vector of the possible values of the parameter a, which is considered in the search for the initial Gompertz parameter values |
gom_b_range |
a numerical vector of the possible values of the parameter b, which is considered in the search for the initial Gompertz parameter values |
gom_k_range |
a numerical vector of the possible values of the parameter k, which is considered in the search for the initial Gompertz parameter values |
d_gom_a1_range |
A numerical vector representing the range of potential values for the 'a1' parameter within the double Gompertz function. |
d_gom_a2_range |
A numerical vector representing the range of potential values for the 'a2' parameter within the double Gompertz function. |
d_gom_b1_range |
A numerical vector representing the range of potential values for the 'b1' parameter within the double Gompertz function. |
d_gom_b2_range |
A numerical vector representing the range of potential values for the 'b2' parameter within the double Gompertz function. |
d_gom_k1_range |
A numerical vector representing the range of potential values for the 'k1' parameter within the double Gompertz function. |
d_gom_k2_range |
A numerical vector representing the range of potential values for the 'k2' parameter within the double Gompertz function. |
a list with the following elements:
$fitted - a data frame with fitted values
$gompertz_initial_parameters - a data frame that contains a curated selection of initial parameter values for the Gompertz function.
$gompertz_model_parameters - a data frame with final model coefficients for the Gompertz function.
$gompertz_initial_parameters_errors - a data frame with unsuccessful cases of Gompertz grid search.
$double_gompertz_initial_parameters - a data frame that contains a curated selection of initial parameter values for the double Gompertz function.
$double_gompertz_initial_parameters_errors - a data frame with unsuccessful cases of double Gompertz grid search.
$doble_gompertz_model_parameters - a data frame with final model coefficients for the double Gompertz function.
library(rTG) # 1 Example on xylem and phloem data data(parameters) data(data_trees) # subset data_trees data_trees <- data_trees[c(1:27),] # 1a Example using neural network simulation_1a <- XPSgrowth(data_trees = data_trees, parameters = parameters, ID_vars = c("Species", "Tissue", "Site", "Year", "Tree"), fitting_method = c("brnn"), fitted_save = FALSE, search_initial_gom = FALSE, add_zeros = TRUE, add_zeros_before = 'min', post_process = TRUE) ## Not run: #' # 1b Example on double Gompertz function simulation_1b <- XPSgrowth(data_trees = data_trees, parameters = parameters, ID_vars = c("Species", "Tissue", "Site", "Year"), fitting_method = c("double_gompertz"), fitted_save = FALSE, search_initial_double_gom = FALSE, unified_parameters = TRUE, add_zeros = TRUE, add_zeros_before = 'min', d_gom_a1 = 0.204, d_gom_a2 = 0.240, d_gom_b1 = 2.433, d_gom_b2 = 2.900, d_gom_k1 = 0.974, d_gom_k2 = 0.963, post_process = TRUE) # 1b Example on Double Gompertz function without initial parameters simulation_1c <- XPSgrowth(data_trees = data_trees, parameters = parameters, ID_vars = c("Species", "Tissue", "Site", "Year"), fitting_method = c("double_gompertz"), fitted_save = FALSE, search_initial_double_gom = TRUE, post_process = TRUE) # Obtain model parameters simulation_1c$double_gompertz_model_parameters ## End(Not run) # 2 Example on dendrometer data data("data_dendrometers") simulation_2 <- XPSgrowth(data_dendrometers, unified_parameters = TRUE, ID_vars = c("site", "species", "year", "tree"), fitting_method = c("brnn", "gam"), brnn_neurons = 2, gam_k = 9, gam_sp = 0.5, search_initial_gom = TRUE, add_zeros = FALSE, post_process = TRUE)
library(rTG) # 1 Example on xylem and phloem data data(parameters) data(data_trees) # subset data_trees data_trees <- data_trees[c(1:27),] # 1a Example using neural network simulation_1a <- XPSgrowth(data_trees = data_trees, parameters = parameters, ID_vars = c("Species", "Tissue", "Site", "Year", "Tree"), fitting_method = c("brnn"), fitted_save = FALSE, search_initial_gom = FALSE, add_zeros = TRUE, add_zeros_before = 'min', post_process = TRUE) ## Not run: #' # 1b Example on double Gompertz function simulation_1b <- XPSgrowth(data_trees = data_trees, parameters = parameters, ID_vars = c("Species", "Tissue", "Site", "Year"), fitting_method = c("double_gompertz"), fitted_save = FALSE, search_initial_double_gom = FALSE, unified_parameters = TRUE, add_zeros = TRUE, add_zeros_before = 'min', d_gom_a1 = 0.204, d_gom_a2 = 0.240, d_gom_b1 = 2.433, d_gom_b2 = 2.900, d_gom_k1 = 0.974, d_gom_k2 = 0.963, post_process = TRUE) # 1b Example on Double Gompertz function without initial parameters simulation_1c <- XPSgrowth(data_trees = data_trees, parameters = parameters, ID_vars = c("Species", "Tissue", "Site", "Year"), fitting_method = c("double_gompertz"), fitted_save = FALSE, search_initial_double_gom = TRUE, post_process = TRUE) # Obtain model parameters simulation_1c$double_gompertz_model_parameters ## End(Not run) # 2 Example on dendrometer data data("data_dendrometers") simulation_2 <- XPSgrowth(data_dendrometers, unified_parameters = TRUE, ID_vars = c("site", "species", "year", "tree"), fitting_method = c("brnn", "gam"), brnn_neurons = 2, gam_k = 9, gam_sp = 0.5, search_initial_gom = TRUE, add_zeros = FALSE, post_process = TRUE)