explained_variance: Calculates the proportion of explained variance of...

View source: R/explained_variance.R

explained_varianceR Documentation

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} \sum_{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

spls, splsda, plotIndiv, plotVar, cim, network.

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


mixOmicsTeam/mixOmics documentation built on Dec. 3, 2024, 11:15 p.m.