corr2d  R Documentation 
corr2d
calculates the synchronous and asynchronous correlation
spectra between Mat1
and Mat1
(homo correlation)
or between Mat1
and Mat2
(hetero correlation).
corr2d( Mat1, Mat2 = NULL, Ref1 = NULL, Ref2 = NULL, Wave1 = NULL, Wave2 = NULL, Time = NULL, Int = stats::splinefun, N = 2^ceiling(log2(NROW(Mat1))), Norm = 1/(pi * (NROW(Mat1)  1)), scaling = 0, corenumber = parallel::detectCores(), preview = FALSE )
Mat1, Mat2 
Numeric matrix containing the data which will be correlated;
'spectral variable' by columns and 'perturbation variables'
by rows. For hetero correlations 
Ref1, Ref2 
Numeric vector containing a single spectrum, which will be
subtracted from 
Wave1, Wave2 
Numeric vector containing the spectral variable. Needs to be
specified if column names of 
Time 
Numeric vector containing the perturbation variables. If specified, 
Int 
Function specifying how the dataset will be interpolated to give

N 
Positive, nonzero integer specifying how many equally spaced
perturbation variables should be interpolated using 
Norm 
A number specifying how the correlation matrix should be normalized. 
scaling 
Positive real number used as exponent when scaling the dataset with its standard deviation. Defaults to 0 meaning no scaling. 0.5 (Pareto scaling) and 1 (Pearson scaling) are commonly used to enhance weak correlations relative to strong correlations. 
corenumber 
Positive, nonzero integer specifying how many CPU cores should be used for parallel fft computation. 
preview 
Logical: Should a 3D preview of the synchronous correlation
spectrum be drawn at the end? Uses 
corr2d
uses a parallel fast Fourier transformation
(fft
) to calculate the complex correlation matrix.
For parallelization the foreach
function is used.
Large input matrices (> 4000 columns) can lead to long calculation times
depending on the number of cores used. Also note that the resulting
matrix can become very large, adjust the RAM limit with
memory.limit
accordingly. For a detailed description
of the underlying math see references.
corr2D
returns a list of class "corr2d" containing the complex
correlation matrix ($FT
), the used reference spectra ($Ref1
,
$Ref2
), the spectral variables ($Wave1
, $Wave2
), the
Fourier transformed data ($ft1
, $ft2
), the (interpolated)
perturbation variables ($Time
) and logical variable ($Het
)
indicating if homo (FALSE
) or hetero (TRUE
) correlation was done.
I. Noda (1993) <DOI:10.1366/0003702934067694>
I. Noda (2012) <DOI:10.1016/j.vibspec.2012.01.006>
R. Geitner et al. (2019) <DOI:10.18637/jss.v090.i03>
For plotting of the resulting list containing the 2D correlation
spectra see plot_corr2d
and plot_corr2din3d
.
data(FuranMale, package = "corr2D") twod < corr2d(FuranMale, Ref1 = FuranMale[1, ], corenumber = 1) plot_corr2d(twod, xlab = expression(paste("relative Wavenumber" / cm^1)), ylab = expression(paste("relative Wavenumber" / cm^1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.