smooth_matrix: smooth_matrix

View source: R/smooth_matrix.R

smooth_matrixR Documentation

smooth_matrix

Description

Removes unrealistic values in a matrix and replaces them with mean of values in a window 3 x 3 around the unrealistic value. Unrealistic value is determined by a factor_drop.

Usage

smooth_matrix(mat, factor_drop = 0.7, repeats = 3)

Arguments

mat

a matrix or data.frame

factor_drop

a number that specifies by how many comparing to two the closest values in a row (i +1 and i -1), to be considered as a unrealistic value.

repeats

an integer that specifies number of repeats of smoothing. Important when there are more unrealistic values one by another.

Value

a matrix with replaced unrealistic values

Examples


library(dendroTools)
data(LJ_daily_temperatures)
data(example_proxies_1)
Example1 <- daily_response(response = example_proxies_1,
env_data = LJ_daily_temperatures, method = "brnn",
metric = "r.squared", lower = 250, upper = 251,
previous_year = FALSE, brnn_smooth = TRUE, alpha = 0.1,
row_names_subset = TRUE)
smoothed <- smooth_matrix(mat = Example1[[1]])

mat_1 <-  matrix(seq(1.01, 2, by = 0.01)  , ncol = 10, byrow = TRUE)
mat_1[5 ,5] <- -1
mat_2 <- smooth_matrix(mat_1)


jernejjevsenak/dendroTools documentation built on April 28, 2024, 5:09 p.m.