smooth_matrix: smooth_matrix

Description Usage Arguments Value Examples

View source: R/smooth_matrix.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
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)

## End(Not run)

dendroTools documentation built on Jan. 3, 2022, 5:09 p.m.