XPSgrowth: XPSgrowth

View source: R/XPSgrowth.R

XPSgrowthR Documentation

XPSgrowth

Description

XylemPhloemSeasonalGrowth: This Function fits and compares the selected methods for modeling seasonal xylem and phloem data.

Usage

XPSgrowth(
  data_trees,
  parameters = NULL,
  search_initial_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,
  brnn_neurons = NA,
  gam_k = NA,
  gam_sp = NA,
  gom_a_range = c(1, 3000, 500),
  gom_b_range = seq(1, 1000, 50),
  gom_k_range = seq(1, 500, 2)
)

Arguments

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

fitting_method

vector of one or more methods to be compared: "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', 'gom_k', '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

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

Value

a list with the following elements:

  1. $fitted - a data frame with fitted wood formation data

  2. $gompertz_grid_search - a data frame with selected initial parameter values

  3. $gompertz_grid_search_errors - a data frame with unsuccessful cases of gompertz grid search

Examples

library(rTG)

# 1 Example on xylem and phloem data
data(parameters)
data(data_trees)

simulation_1 <- 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)



# 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)

rTG documentation built on May 12, 2022, 5:05 p.m.

Related to XPSgrowth in rTG...