codis2d: Two-dimensional codistribution spectroscopy.

View source: R/codys2d.R

codis2dR Documentation

Two-dimensional codistribution spectroscopy.


codis2d calculates the synchronous and asynchronous codistribution spectra.


  Ref = NULL,
  Wave = NULL,
  Time = NULL,
  Int = stats::splinefun,
  N = 2^ceiling(log2(NROW(Mat))),
  Norm = 1/(NROW(Mat) - 1),
  scaling = 0,
  corenumber = parallel::detectCores(),
  preview = FALSE



Numeric matrix containing the data which will be correlated; 'spectral variable' by columns and 'perturbation variables' by rows.


Numeric vector containing a single spectrum, which will be subtracted from Mat to generate dynamic spectra for 2D correlation analysis. Default is NULL in which case the colMeans() of Mat is used as reference. The length of Ref needs to be equal to the number of columns in Mat. 2D codistribution spectroscopy is only strictly defined using the perturbation-mean spectrum as reference spectrum. Thus, any deviation from this definition can lead to unexpected results.


Numeric vector containing the spectral variable. Needs to be specified if column names of Mat are undefined.


Numeric vector containing the perturbation variables. If specified, Mat will be interpolated to N equally spaced perturbation variables using Int.


Function specifying how the dataset will be interpolated to give N equally spaced perturbation variables. splinefun (default) or approxfun can for example be used.


Positive, non-zero integer specifying how many equally spaced perturbation variables should be interpolated using Int. N should be higher than 4. corr2d is fastest if N is a power of 2.


A number specifying how the correlation matrix should be normalized.


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. 2D codistribution spectroscopy is only strictly defined without the usage of any scaling techniques. Thus, any deviation from this definition can lead to unexpected results.


Positive, non-zero integer specifying how many CPU cores should be used for parallel fft computation.


Logical: Should a 3D preview of the asynchronous codistribution spectrum be drawn at the end? Uses persp3d from rgl package.


codis2d calculates the the synchronous 2D correlation spectrum and uses the 2D spectrum to calculate the synchronous and asynchronous codistribution spectra. For parallelization the parCapply 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.


codis2D returns a list of class "corr2d" containing the complex codistribution matrix ($FT), the synchronous correlation spectrum ($corr), the used reference spectrum $Ref1 and $Ref2, the spectral variables $Wave1 and $Wave2 as well as the (interpolated) perturbation variables ($Time).


I. Noda (2014) <DOI:10.1016/j.molstruc.2014.01.024>

See Also

For plotting of the resulting list containing the 2D codistribution spectra see plot_corr2d and plot_corr2din3d.


    testdata <- sim2ddata(C = NULL, Camp = NULL)
    codis <- codis2d(testdata, corenumber = 1)
    plot_corr2d(codis, Im(codis$FT),
                xlab = expression(paste("Wavenumber" / cm^-1)),
                ylab = expression(paste("Wavenumber" / cm^-1)))

corr2D documentation built on July 14, 2022, 5:06 p.m.