sapwood_fit: A model for sapwood rings in scots pine

sapwood_fitR Documentation

A model for sapwood rings in scots pine

Description

The function takes in heartwood and sapwood (and possibly tree ring width) data from a dataset and returns a fit and some information about the fit, such as prediction intervals, figures, confidence intervals for parameters etc. See Edvardsson et al.

Usage

sapwood_fit_l(
  formula,
  dat,
  alpha = 0.05,
  mu_theta_1 = log(0.1),
  sd_theta_1 = (log(0.1) + 4 * log(10))/2,
  mu_theta_2 = log(0.1),
  sd_theta_2 = (log(0.1) + 4 * log(10))/2,
  H_0 = 100
)

sapwood_fit_pl(
  formula,
  dat,
  alpha = 0.05,
  mu_theta_1 = log(0.1),
  sd_theta_1 = (log(0.1) + 4 * log(10))/2,
  mu_theta_2 = log(0.1),
  sd_theta_2 = (log(0.1) + 4 * log(10))/2,
  H_0 = 100
)

sapwood_fit_plw(
  formula,
  dat,
  alpha = 0.05,
  mu_theta_1 = log(0.1),
  sd_theta_1 = (log(0.1) + 4 * log(10))/2,
  mu_theta_2 = log(0.1),
  sd_theta_2 = (log(0.1) + 4 * log(10))/2,
  H_0 = 100
)

Arguments

formula

Formula for the fit. If using sapwood_fit_pl or sapwood_fit_l, the formula should be on the form S~H, where S is the name of the column containing the number of sapwood rings and H is the name of the column containing the number of heartwood rings. If using sapwood_fit_plw, the formula should be on the form S~H+W, where S and H are as before, and W is the name of the column including data on mean tree ring width.

dat

Dataset to be fitted to. Column names should match formula arguments

alpha

Confidence of the fit, for prediction, confidence for median and parameter confidence intervals. defaults to 0.05 (which corresponds to 95% confidence)

mu_theta_1

Regularization mu for theta_1 (see Edvardsson et al. 2021)

sd_theta_1

Regularization sigma for theta_1 (see Edvardsson et al. 2021)

mu_theta_2

Regularization mu for theta_2 (see Edvardsson et al. 2021)

sd_theta_2

Regularization sigma for theta_2 (see Edvardsson et al. 2021)

H_0

Cutoff point for parabolic-linear model. Only relevant for sapwood_fit_pl and sapwood_fit_plw.

Value

The functions return objects of class "sapwood_fit". An object of class "sapwood_fit" is a list containing the following components:

parameter_CI

Confidence intervals for the parameters of the model.

predictions

Predictions for the model for H between 0 and 500, if sapwood_fit_l or sapwood_fit_pl are used, prediction and confidence intervals for the fit is included. If sapwood_fit_plw is used, only median of the prediction is returned.

residuals

Standardized residuals of the model. See Edvardsson et al. 2021.

AIC

AIC of the model

formula

The formula for the model, as specified in the input.

type

Type of the model, "parabolic_linear_W", "parabolic_linear" or "linear" (Models 1,2 and 3, respectively).

alpha

Confidence of the model

#' @seealso summary.sapwood_fit for summaries, predict.sapwood_fit for prediction. It is also useful to look at plot.sapwood_fit to help visualize the model.

Examples

data(smaland)
fit <- sapwood_fit_pl(S~H, smaland)
summary(fit)
plot(fit)
plot(fit, type="residual")
plot(fit, type="qq")
residuals(fit)
AIC(fit)


karirogg/ScotsPine documentation built on Nov. 22, 2022, 5:55 a.m.