nipals: NIPALS: Non-linear Iterative Partial Least Squares

View source: R/nipals.R

nipalsR Documentation

NIPALS: Non-linear Iterative Partial Least Squares

Description

Principal Components Analysis with NIPALS algorithm

Usage

  nipals(Data, comps = 2, scaled = TRUE)

Arguments

Data

A numeric matrix or data frame (which may contain missing values).

comps

Number of components to be calculated (by default 2)

scaled

A logical value indicating whether to scale the data (TRUE by default).

Details

The function nipals performs Principal Components Analysis of a data matrix that may contain missing values.

Value

An object of class "nipals", basically a list with the following elements:

When the analyzed data contain missing values, the help interpretation tools (e.g. cor.xt, disto, contrib, cos, dmod) may not be meaningful, that is to say, some of the results may not be coherent.

values

The pseudo eigenvalues

scores

The extracted scores (i.e. components)

loadings

The loadings

cor.xt

Correlations between the variables and the scores

disto

Squared distance of the observations to the origin

contrib

Contributions of the observations (rows)

cos

Squared cosinus

dmod

Distance to the Model

Author(s)

Gaston Sanchez

References

Tenenhaus, M. (1998) La Regression PLS. Theorie et Pratique. Paris: Editions TECHNIP.

Tenenhaus, M. (2007) Statistique. Methodes pour decrire, expliquer et prevoir. Paris: Dunod.

See Also

plot.nipals, plsreg1

Examples

## Not run: 
 # load datasets carscomplete and carsmissing
 data(carscomplete) # complete data
 data(carsmissing)  # missing values

 # apply nipals
 my_nipals1 = nipals(carscomplete)
 my_nipals2 = nipals(carsmissing)

 # plot variables (circle of correlations)
 plot(my_nipals1, what="variables", main="Complete data")
 plot(my_nipals2, what="variables", main="Missing data")

 # plot observations with labels
 plot(my_nipals1, what="observations", show.names=TRUE, main="Complete data")
 plot(my_nipals2, what="observations", show.names=TRUE, main="Missing data")

 # compare results between my_nipals1 and my_nipals2
 plot(my_nipals1$scores[,1], my_nipals2$scores[,1], type="n")
 title("Scores comparison: my_nipals1  -vs-  my_nipals2", cex.main=0.9)
 abline(a=0, b=1, col="gray85", lwd=2)
 points(my_nipals1$scores[,1], my_nipals2$scores[,1], pch=21,
        col="#5592e3", bg = "#5b9cf277", lwd=1.5)
 
## End(Not run)

plsdepot documentation built on April 1, 2023, 12:04 a.m.