Title: | Robust Correlations |
---|---|
Description: | Robust pairwise correlations based on estimates of scale, particularly on "FastQn" one-step M-estimate. |
Authors: | Paul Smirnov |
Maintainer: | Paul Smirnov <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1-6.1 |
Built: | 2025-03-01 05:21:29 UTC |
Source: | https://github.com/cran/robcor |
Compute the robust scale estimator FastQn, an efficient alternative to the MAD, a fast alternative to the Qn.
FastQn(x, center = median(x), scale = mad(x, center)) fqn(x, center = median(x), scale = mad(x, center)) s_FastQn(x, mu.too = FALSE, center = median(x), ...)
FastQn(x, center = median(x), scale = mad(x, center)) fqn(x, center = median(x), scale = mad(x, center)) s_FastQn(x, mu.too = FALSE, center = median(x), ...)
x |
numeric vector of observations. |
center |
optionally, the center: defaults to the median. |
scale |
optionally, the basic scale: defaults to the median absolute deviation. |
mu.too |
logical indicating if the |
... |
potentially further arguments for |
This function computes one-step M-estimate of scale based on provided robust estimate (defaults to the MAD). It gives 50% breakdown point and Gaussian efficiency about 80%.
The fqn
function is a shorter alias, like sd
and
mad
.
FastQn()
returns a number, the FastQn robust scale estimator.
s_FastQn(x, mu.too=TRUE)
returns a length-2 vector with location and scale;
this is typically only useful for covOGK(*, sigmamu = s_FastQn)
or
robcor(*, scaler = s_FastQn)
.
Paul Smirnov <[email protected]>
Smirnov, P. O., Shevlyakov, G. L. (2010). On Approximation of the Qn-Estimate of Scale by Fast M-Estimates. In Book of Abstracts: International Conference on Robust Statistics (ICORS 2010) (pp. 94-95). Prague, Czech Republic.
set.seed(153) x <- sort(c(rnorm(80), rt(20, df = 1))) s_FastQn(x, mu.too=TRUE) FastQn(x)
set.seed(153) x <- sort(c(rnorm(80), rt(20, df = 1))) s_FastQn(x, mu.too=TRUE) FastQn(x)
Correct pseudo-correlation matrices to make them positive semidefinite ones.
psdcor(m, method = c("higham", "eigen"), ...)
psdcor(m, method = c("higham", "eigen"), ...)
m |
pseudo-correlation matrix to correct. |
method |
optionally, correction method to use. |
... |
potentially further arguments for the particular correction method. |
This function applies transformation to the given matrix in order to make it positive semidefinite correlation matrix.
When method is higham
, use Higham projections algorithm via nearPD()
function.
When method is eigen
, use direct eigenvalues correction via posdefify()
function.
The corrected matrix.
Paul Smirnov <[email protected]>
Compute (and by default plot) an estimate of the autocovariance or autocorrelation function.
robacf(x, lag.max = NULL, type = c("correlation", "covariance"), plot = TRUE, scaler = "s_FastQn", ...)
robacf(x, lag.max = NULL, type = c("correlation", "covariance"), plot = TRUE, scaler = "s_FastQn", ...)
x |
a univariate numeric time series object or a numeric vector. |
lag.max |
maximum lag at which to calculate the acf. Default is |
type |
character string giving the type of acf to be computed.
Allowed values are |
plot |
logical. If |
scaler |
location-scale estimator to use in the algorithm.
By default, |
... |
further arguments to be passed to |
This function is a robust replacement for acf()
.
Note, that implementation and documentation is not finished/polished yet.
A list of class "acf"
. For description of elements see acf()
.
WORK-IN-PROGRESS status.
Paul Smirnov <[email protected]>
Shevlyakov, G. L., Lyubomishchenko, N. S. and Smirnov, P. O. (2013). Some remarks on robust estimation of power spectra. Proceedings of the 11th International Conference on Computer Data Analysis and Modeling, Minsk, Belarus, 97–104.
Fit an autoregressive time series model to the data using robust algorithms.
robar(x, order = 2, scaler = "s_FastQn")
robar(x, order = 2, scaler = "s_FastQn")
x |
a univariate time series. |
order |
an order of model to fit. |
scaler |
location-scale estimator to use in the algorithm.
By default, |
This function is a robust replacement for ar()
.
Note, that implementation and documentation is not finished/polished yet.
A list of class "ar"
. For description of elements see ar()
.
WORK-IN-PROGRESS status.
Paul Smirnov <[email protected]>
Shevlyakov, G. L., Lyubomishchenko, N. S. and Smirnov, P. O. (2013). Some remarks on robust estimation of power spectra. Proceedings of the 11th International Conference on Computer Data Analysis and Modeling, Minsk, Belarus, 97–104.
n <- 100 set.seed(361) eps <- as.ts(rnorm(n)) x <- arima.sim(list(ar=c(1,-0.9)), n, innov=eps) # basic signal z <- as.ts(rbinom(n, 1, 0.1) * rnorm(n, sd=10)) # noise y <- x + z spec.ar(robar(y, order=2))
n <- 100 set.seed(361) eps <- as.ts(rnorm(n)) x <- arima.sim(list(ar=c(1,-0.9)), n, innov=eps) # basic signal z <- as.ts(rbinom(n, 1, 0.1) * rnorm(n, sd=10)) # noise y <- x + z spec.ar(robar(y, order=2))
Compute a robust estimate of the correlation coefficient or correlation matrix via pairwise correlations.
robcor(x, y = NULL, method = c("ssd", "quadrant", "mcd"), partial = FALSE, post = "psdcor", scaler = "s_FastQn", regress = "lmrob")
robcor(x, y = NULL, method = c("ssd", "quadrant", "mcd"), partial = FALSE, post = "psdcor", scaler = "s_FastQn", regress = "lmrob")
x |
a numeric vector, matrix or data frame. |
y |
|
method |
a character string indicating which correlation coefficient is to be computed. |
partial |
logical. Should a partial correlation algorithm be used? |
post |
function to apply after the matrix is built or |
scaler |
function to use as a location-scale estimator in |
regress |
function to use as a regression estimator in partial correlations algorithm.
By default, |
This function is a robust replacement for cor()
.
Note, that implementation and documentation is not finished/polished yet.
Either a single correlation coefficient or a correlation matrix estimate.
WORK-IN-PROGRESS status.
Paul Smirnov <[email protected]>
Shevlyakov, G. L., Smirnov, P. O. (2011). Robust Estimation of the Correlation Coefficient: An Attempt of Survey. Austrian Journal of Statistics, 40(1&2), 147-156.