View source: R/RegressionInterpolation.R
RegressionInterpolation | R Documentation |
RegressionInterpolation
RegressionInterpolation(Y, X, CorrectionType = "linear", Local = FALSE)
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) |
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.
Y (numeric) with interpolated missing values depending on the form of model chosen (CorrectionType)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.