plspredict.m

% ------------------------------------------------------------------------
% Function: [Yp,Yt,b,T,P,U,R,R2X,R2Y]=plspredict(X,y,standard,h,Xt)
% ------------------------------------------------------------------------
% Aim:
% Prediction of y based on the PLS model
% ------------------------------------------------------------------------
% Input: 
% X, matrix (n,p), predictor matrix 
% y, vector (n,1), predictand
% standard, scalar, standardization 1/yes or 0/no (only centering)
% h, scalar, number of PLS factors
% Xt, matrix (n,p), optionally predictor matrix for test set, if not
% available put [] or do not specify at all
% ------------------------------------------------------------------------
% Output: 
% Yp, matrix (n,h), prediction for each object from model set (X matrix)
% Yt, matrix (n,h), prediction for each object from test set (Xt matrix)
% b, vector (p,1), regression coefficients for the model with h factors
% T, matrix (n,h), X scores
% P, matrix (p,h), X loadings
% U, matrix (n,h), Y scores
% R, matrix (p,h), X weights
% R2X, vecor (1,h), X-variance
% R2Y, vecor (1,h), Y-variance
% ------------------------------------------------------------------------
% Example:
% 1/ only for model set prediction:     
% Yp=plspredict(X,y,0,6)
% 2/ for model and test set prediction: 
% [Yp,Yt]=plspredict(X,y,1,6,Xt)
% ------------------------------------------------------------------------
Valid CSS! Valid HTML 4.01!