smooth_matrix: smooth_matrix

Description Usage Arguments Value Examples

View source: R/smooth_matrix.R

Description

Removes unrealistic values in a matrix and replace them with an average 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
data(daily_temperatures_example)
data(example_proxies_1)
Example1 <- daily_response(response = example_proxies_1,
env_data = daily_temperatures_example, method = "brnn",
measure = "r.squared", lower = 250, upper = 251,
previous_year = FALSE, brnn_smooth = 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)

dendroExtra documentation built on Aug. 4, 2017, 5:03 p.m.