SVD: Single Value Decomposition (Maximum Covariance Analysis)

View source: R/SVD.R

SVDR Documentation

Single Value Decomposition (Maximum Covariance Analysis)

Description

Computes a Maximum Covariance Analysis (MCA) between vary and varx, both of dimensions c(n. of time steps, n. of latitudes, n. of longitudes), each over a region of interest, e.g.: prlr over Europe and tos over North Atlantic. The input fields are latitude-weighted by default (can be adjustable via weight).
Returns a vector of squared covariance fraction (SCFs) explained by each pair of covariability modes, a vector of correlation coefficient (RUVs) between expansion coefficients (ECs) that measures their linear relationship, and a set of regression (MCAs) associated with the covariability modes (ECs). Note that MCAs are 'homogeneous' patterns obtained as regression/correlation between each field (predictor, predictand) and its expansion coefficient.
The MCA is computed by default with the covariance matrix. It can be computed with the correlation matrix by setting corr = TRUE.

Usage

SVD(
  vary,
  varx,
  laty = NULL,
  latx = NULL,
  nmodes = 15,
  corr = FALSE,
  weight = TRUE
)

Arguments

vary

Array containing the anomalies field for the predictor. The expected dimensions are c(n. of time steps, n. of latitudes, n. of longitudes).

varx

Array containing the anomalies field for the predictand. The expected dimensions are c(n. of time steps, n. of latitudes, n. of longitudes).

laty

Vector of latitudes of the array vary. Only required if weight = TRUE.

latx

Vector of latitudes of the array varx. Only required if weight = TRUE.

nmodes

Number of ECs/MCAs/modes retained and provided in the outputs.

corr

Whether to compute the MCA over a covariance matrix (FALSE) or a correlation matrix (TRUE).

weight

Whether to apply latitude weights on the input fields or not. TRUE by default.

Value

$SC

Vector of squared covariance (n. of modes).

$SCFs

Vector of squared covariance fractions (n. of modes).

$RUVs

Vector of correlations between expansion coefficients (n. of modes).

$ECs_U

Array of expansion coefficients of predictor field (n. of time steps, n. of modes).

$MCAs_U

Array of covariability patterns of predictor field (c(dim), n. of modes).

$ECs_V

Array of expansion coefficients of predictand field (n. of time steps, n. of modes).

$MCAs_V

Array of covariability patterns of predictand field (c(dim), n. of modes).

Author(s)

History:
0.1 - 2010-09 (J.-G. Serrano) - Original code
1.0 - 2016-04 (N. Manubens) - Formatting to R CRAN

Examples

# See examples on Load() to understand the first lines in this example
 ## Not run: 
data_path <- system.file('sample_data', package = 's2dverification')
expA <- list(name = 'experiment', path = file.path(data_path, 
            'model/$EXP_NAME$/$STORE_FREQ$_mean/$VAR_NAME$_3hourly',
            '$VAR_NAME$_$START_DATE$.nc'))
obsX <- list(name = 'observation', path = file.path(data_path,
            '$OBS_NAME$/$STORE_FREQ$_mean/$VAR_NAME$',
            '$VAR_NAME$_$YEAR$$MONTH$.nc'))

# Now we are ready to use Load().
startDates <- c('19851101', '19901101', '19951101', '20001101', '20051101')
sampleData <- Load('tos', list(expA), list(obsX), startDates, 
                  leadtimemin = 1, leadtimemax = 4, output = 'lonlat',
                  latmin = 27, latmax = 48, lonmin = -12, lonmax = 40)
 
## End(Not run)
 
# This example computes the ECs and MCAs along forecast horizons and plots the 
# one that explains the greatest amount of variability. The example data is 
# very low resolution so it does not make a lot of sense.
ano <- Ano_CrossValid(sampleData$mod, sampleData$obs)
mca <- SVD(Mean1Dim(ano$ano_exp, 2)[1, , 1, , ], 
          Mean1Dim(ano$ano_obs, 2)[1, , 1, , ], 
          sampleData$lat, sampleData$lat)
PlotEquiMap(mca$MCAs_U[1, , ], sampleData$lon, sampleData$lat)
plot(mca$ECs_U[1, ])
PlotEquiMap(mca$MCAs_V[1, , ], sampleData$lon, sampleData$lat)
plot(mca$ECs_V[1, ])


s2dverification documentation built on April 20, 2022, 9:06 a.m.