Learn R Programming

textir (version 1.4)

pls: Partial Least Squares

Description

A simple partial least squares procedure.

Usage

pls(F, y, K=1, scale=TRUE, verb=TRUE)

Arguments

F
The covariate matrix, in either simple_triplet_matrix or matrix format.
y
The response vector.
K
The number of desired PLS directions.
scale
An indicator for whether to standardize F; usually a good idea. If scale=TRUE, F will be scaled to have variance-one columns.
verb
Whether or not to print a small progress script.

Value

  • A pls object list with the following entries
  • yThe response vector.
  • FThe covariate matrix. If scale=TRUE, scaled to have variance-one columns.
  • zThe pls directions F%*%phi.
  • vResponse factors.
  • yhatK columns of fitted values for each number of directions.
  • fwdmodThe lm object from forward regression lm(as.numeric(y)~z).
  • scaleIndicator for whether input F was scaled.

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 normalize(as.numeric(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, corr, we8there, congress109

Examples

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

data(we8there)
fit <- pls(freq(we8thereCounts),as.factor(we8thereRatings$Overall))
plot(fit, col=c(2,2,2,3,3))

Run the code above in your browser using DataLab