View source: R/rescale_variance.R
rescale_variance | R Documentation |
R wrapper for C function computing the (rescaled) median absolute difference in differences for each row of the input matrix. The rescaling factor is set to 1.05 (corresponding to the Normal distribution). Each row of the input matrix then re-scaled by the corresponding noise estimate.
rescale_variance(X, debug = FALSE)
X |
A |
debug |
If |
A list containing
X |
the input matrix, variance re-scaled and flattened |
scales |
vector of MAD estimates of the noise level of each row of the input matrix |
library(HDCD)
n = 200
p = 500
set.seed(101)
# Generating data
X = matrix(rnorm(n*p), ncol = n, nrow=p)
ret = rescale_variance(X)
ret$X #rescaled matrix
ret$scales #estimated noise level for each time series (each row)
# Note that the rescaled matrix is in (column wise) vector form. To transform it back to a matrix,
# do the following:
rescaled_X = matrix(ret$X, nrow = p, ncol=n)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.