Learn R Programming

BIOMASS (version 2.1.11)

summaryByPlot: Summarize by plot (or subplot) the posterior distribution of AGB values

Description

This function summarizes the matrix AGB_val given by the function AGBmonteCarlo() by plot. Or just do the sums for each plot of the AGB if the argument AGB_val is the resulting vector from the function computeAGB().

Usage

summaryByPlot(AGB_val, plot, drawPlot = FALSE, subplot = NULL)

Value

a data frame where:

  • plot: the code of the plot

  • AGB: AGB value at the plot level

  • Cred_2.5: the quantile 2.5\

  • Cred_97.5: the quantile 97.5\

If the subplot is set, the output is a list with the previous data frame and a simple features (sf) geometry object.

Arguments

AGB_val

Matrix resulting from the function AGBmonteCarlo() (AGB_val element of the list), or just the output of the function AGBmonteCarlo(). Or the output of the function computeAGB()

plot

Vector with the code of plot

drawPlot

a logical to draw the plot (see Details)

subplot

Data frame, output of the function cutPlot()

Details

If some trees belong to an unknown plot (i.e. NA value in the plot arguments), their AGB values are randomly assigned to a plot at each iteration of the AGB monte Carlo approach. Or discarded when using output from computeAGB().

The drawPlot argument is a logical that if it is set TRUE, a graph will appear with the plot given on absciss and the value of AGB on ordinate, the red segments are the quantile, if AGB_val is the result of the function AGBmonteCarlo(). If the subplot arguments is set and the drawPlot is set TRUE, a graph is drawn with the spatialisation of the plots.

Examples

Run this code

# Load a database
data(NouraguesHD)
data(KarnatakaForest)

# Modelling height-diameter relationship
HDmodel <- modelHD(D = NouraguesHD$D, H = NouraguesHD$H, method = "log2")

# Retrieving wood density values
# \donttest{
KarnatakaWD <- getWoodDensity(KarnatakaForest$genus, KarnatakaForest$species,
  stand = KarnatakaForest$plotId
)
# }

# Propagating errors
# \donttest{
filt <- KarnatakaForest$plotId %in% c("BSP20", "BSP14")
resultMC <- AGBmonteCarlo(
  D = KarnatakaForest$D[filt], WD = KarnatakaWD$meanWD[filt],
  errWD = KarnatakaWD$sdWD[filt], HDmodel = HDmodel
)

plot <- KarnatakaForest$plotId[ filt ]

# The summary by plot
summaryByPlot(AGB_val = resultMC$AGB_simu, plot)

# The summary by plot for computeAGB
H <- retrieveH(KarnatakaForest$D[filt], model = HDmodel)$H
AGB <- computeAGB(KarnatakaForest$D[filt], WD = KarnatakaWD$meanWD[filt], H = H)
summaryByPlot(AGB, plot)
# }

Run the code above in your browser using DataLab