Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

explained_variance

Calculates the proportion of explained variance of multivariate components


Description

explained_variance calculates the proportion of variance explained by a set of *orthogonal* variates / components and divides by the total variance in data using the definition of 'redundancy'. This applies to any component-based approaches where components are orthogonal. It is worth noting that any missing values are set to zero (which is the column mean for the centered input data) prior to calculation of total variance in the data. Therefore, this function would underestimate the total variance in presence of abundant missing values. One can use impute.nipals function to impute the missing values to avoid such behaviour.

Usage

explained_variance(data, variates, ncomp)

Arguments

data

numeric matrix of predictors

variates

variates as obtained from a pls object for instance

ncomp

number of components. Should be lower than the number of columns of variates

Details

Variance explained by component t_h in X for dimension h:

Rd(X, t_h) = \frac{1}{p} ∑_{j = 1}^p \mbox{cor}^2(X^j, t_h)

where X^j is the variable centered and scaled, p is the total number of variables.

Value

explained_variance returns a named numeric vector containing the proportion of explained variance for each variate after setting all missing values in the data to zero (see details).

Author(s)

Florian Rohart, Kim-Anh Lê Cao, Al J Abadi

References

Tenenhaus, M., La Régression PLS théorie et pratique (1998). Technip, Paris, chap2.

See Also

Examples

data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic

toxicity.spls <- spls(X, Y, ncomp = 2, keepX = c(50, 50), keepY = c(10, 10))

ex = explained_variance(toxicity.spls$X, toxicity.spls$variates$X, ncomp =2)

# ex should be the same as
toxicity.spls$prop_expl_var$X

mixOmics

Omics Data Integration Project

v6.14.1
GPL (>= 2)
Authors
Kim-Anh Le Cao [aut, cre], Florian Rohart [aut], Ignacio Gonzalez [aut], Sebastien Dejean [aut], Al Abadi [ctb], Benoit Gautier [ctb], Francois Bartolo [ctb], Pierre Monget [ctb], Jeff Coquery [ctb], FangZou Yao [ctb], Benoit Liquet [ctb]
Initial release
2021-04-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.