DiameterCorrection: Diameter correction

View source: R/DiameterCorrection.R

DiameterCorrectionR Documentation

Diameter correction

Description

Diameter correction

Usage

DiameterCorrection(
  Data,
  KeepMeas = c("MaxHOM", "MaxDate"),
  DefaultHOM = 1.3,
  MaxDBH = 500,
  PositiveGrowthThreshold = 5,
  NegativeGrowthThreshold = -2,
  Pioneers = NULL,
  PioneersGrowthThreshold = 7.5,
  WhatToCorrect = c("POM change", "punctual", "shift"),
  CorrectionType = c("individual", "phylogenetic hierarchical"),
  DBHRange = 10,
  MinIndividualNbr = 5,
  OtherCrit = NULL,
  Digits = 1L,
  DBHCorForDeadTrees = TRUE,
  coef = 0.9,
  DetectOnly = FALSE
)

Arguments

Data

Dataset (data.frame or data.table) The dataset must contain the columns:

  • IdTree or IdStem (character)

  • ScientificName_TreeDataCor (character)

  • Diameter (numeric)

  • Year (numeric)

  • POM (Point Of Measurement) (factor) or HOM (Height Of Measurement) (numeric) if you want to correct from the "POM change" If you want to apply the "phylogenetic hierarchical" correction, the dataset must also contain the columns:

  • Genus_TreeDataCor (character)

  • Family_TreeDataCor (character)

KeepMeas

In case of multiple diameter measurements in the same census year: Possible values: "MaxHOM", "MaxDate" (character).

  • "MaxHOM": apply the correction to the measurement taken at the highest POM

  • "MaxDate": apply the correction to the most recent measurement (same year but more recent date)

DefaultHOM

Default Height Of Measurement in meter (Default: 1.3 m) (numeric, 1 value)

MaxDBH

Maximum possible DBH (Diameter at the default HOM) of your stand in cm (numeric, 1 value)

PositiveGrowthThreshold

in cm/year: a tree widening by more than this value is considered abnormal (numeric, 1 value)

NegativeGrowthThreshold

in cm/census: the possible positive measurement error (+n) cannot be corrected until the growth appears abnormal, but a negative measurement error can be allowed until -n (a tree does not decrease). Thus the positive measurement error (+n) is "compensated". (numeric, 1 value)

Pioneers

Scientific names of the pioneer species of the site, as in the ScientificName_TreeDataCor column (characters vector)

PioneersGrowthThreshold

in cm/year: a tree of a pioneer species that widens by more than this value is considered abnormal (numeric, 1 value)

WhatToCorrect

Possible values: "POM change", "punctual", "shift" (character)

  • "POM change": detect POM change in the column POM and correct the Diameter values from it.

  • "punctual": detect if the error is punctual and correct it by interpolation.

  • "shift": detect if there is a shift of several Diameter values and links them to the 1st measurements set.

CorrectionType

Possible values: "individual", "phylogenetic hierarchical" (character).

  • "individual": replace abnormal growth by interpolation from the individual values.

  • "phylogenetic hierarchical": replace abnormal growth with the average growth of other trees in the dataset, at the specific, genus, family or stand level, within a DBH range of x cm (DBHRange argument). If the number of these trees < n (MinIndividualNbr argument) at the specific level, we switch to the genus level etc.

DBHRange

DBH range in cm to take into account to select other trees in the dataset to apply "phylogenetic hierarchical" correction (Default: 10 cm) (numeric, 1 value)

MinIndividualNbr

Minimum number of individuals to take into account in "phylogenetic hierarchical" correction (Default: 5) (numeric, 1 value)

OtherCrit

Other criteria to select the individuals used for the calculation of the mean growth in the "phylogenetic hierarchical" correction. Give the name of the column(s) for which the individuals must have the same value as the tree to correct (e.g. c("Plot", "Subplot")) (character)

Digits

Number of decimal places to be used in the DBHCor column (Default: 1L) (integer)

DBHCorForDeadTrees

(logical) TRUE: return DBHCor also for dead trees. FALSE: do not return DBHCor for dead trees. In this case it is advisable to have corrected the tree life status with the StatusCorrection() function.

coef

description... (numeric)

DetectOnly

TRUE: Only detect errors, FALSE: detect and correct errors (Default: FALSE) (logical)

Details

When there is only 1 Diameter value for a tree/stem, Diameter_TreeDataCor takes the original Diameter value. If this value is 0 or > MaxDBH, Diameter_TreeDataCor takes NA. Diameters not linked to an IdTree/IdStem or to a Census Year are not processed. Punctual error correction only with linear regression and not quadratic, because punctual errors are corrected from a local regression with the 2 framing values.

Value

Fill the Comment column with error type informations. If DetectOnly = FALSE, add columns:

  • Diameter_TreeDataCor: corrected trees diameter at default HOM

  • DiameterCorrectionMeth = "local linear regression","weighted mean"/phylogenetic hierarchical("species"/"genus"/"family"/"stand")/ "shift realignment"/"Same value".

  • POM_TreeDataCor (factor): POM value at which the corrected diameters are proposed. Corresponds to the 1st POM value at which the stem was measured.

  • HOM_TreeDataCor (numeric): HOM value at which the corrected diameters are proposed. Corresponds to the 1st HOM value at which the stem was measured.

Examples

library(data.table)
data(TestData)

Rslt <- DiameterCorrection(
 TestData,
  WhatToCorrect = c("POM change", "punctual", "shift"),
    CorrectionType = c("linear", "individual"),
    MinIndividualNbr = 1, Digits = 2L)

DiameterCorrectionPlot(Rslt, OnlyCorrected = TRUE)


VincyaneBadouard/TreeData documentation built on Jan. 4, 2024, 2:56 a.m.