RegressionInterpolation: RegressionInterpolation

View source: R/RegressionInterpolation.R

RegressionInterpolationR Documentation

RegressionInterpolation

Description

RegressionInterpolation

Usage

RegressionInterpolation(Y, X, CorrectionType = "linear", Local = FALSE)

Arguments

Y

Response variable with missing value (NA) (numeric)

X

Explanatory variable (numeric)

CorrectionType

"quadratic" and/or "linear" (character)

Local

If FALSE, compute the regression on all the Y and X values, if TRUE compute the regression between the 2 surrounding values of the missing value (NA) (default: FALSE) (logical)

Details

The variables X and Y must be of the same length. Because local regression (Local = TRUE) is done with the 2 framing values, this regression is always linear and not quadratic.

Value

Y (numeric) with interpolated missing values depending on the form of model chosen (CorrectionType)

Examples


DBH = c(34.5, NA, 34.0, 34.6, 35.0, 34.9, NA)
Time = c(1998, 2008, 2016, 2017, 2018, 2019, 2021)
plot(Time, DBH)


# Compute the corrected DBH
DBHCor <- RegressionInterpolation(Y = DBH, X = Time, Local = FALSE)

DBHCorLocal <- RegressionInterpolation(Y = DBH, X = Time, Local = TRUE)

plot(Time, DBHCor)
plot(Time, DBHCorLocal)


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