Learn R Programming

textir (version 1.1)

pls: Partial Least Squares

Description

A simple partial least squares procedure.

Usage

pls(F, y, K=1)

Arguments

F
The covariate matrix. It is usually best that this is first standardized with the normalize function to have mean-zero and variance-one columns
y
The response vector.
K
The number of desired PLS directions.

Value

  • A pls object list with the following entries
  • yThe response vector.
  • FThe covariate matrix.
  • zThe pls directions F%*%phi.
  • vResponse factors.
  • yhatK columns of fitted values for each number of directions.
  • fwdmodThe lm object from forward regression lm(y~z).

Details

Fits the Partial Least Squares algorithm described in Taddy (2011; Section 3.1). In particular, we obtain loadings phi[,k] as the correlation between F and factors v[,k], where v[,1] is initialized at y and subsequent factors are orthogonal to the k'th pls direction, z[,k]=F%*%phi[,k].

References

Taddy (2011), Inverse Regression for Analysis of Sentiment in Text. http://arxiv.org/abs/1012.2098

Wold, H. (1975), Soft modeling by latent variables: The nonlinear iterative partial least squares approach. In Perspectives in Probability and Statistics, Papers in Honour of M.S. Bartlett.

See Also

plot.pls, normalize, freq

Examples

Run this code
data(congress109)
F <- normalize(freq(congress109Counts))
y <- normalize(congress109Ideology$repshare)
fit <- pls(F, y, K=4)
plot(fit, pch=21, bg=c(4,3,2)[congress109Ideology$party])

Run the code above in your browser using DataLab