Partial Least Squares Regression Model

clear;
%Multiple correlation diagnosis
load('data.mat'); %Pre-write the data file data.mat and save it to the current working path
cr=corrcoef(data) %Calculate the correlation coefficient between the variables
% to establish the smallest deviation The two-fold regression model
%(1) Extract all possible principal components
X=data(:,1:5);
Y=data(:,6:8);
E0=stand(X)
F0=stand(Y)
A= rank(E0)
[W,C,T,U,P,R]=plspcr(E0,F0)% extract all possible principal components

%(2) Principal component interpretation ability analysis
% Calculate the principal component cumulative multiple determination coefficient
RA=plsra(T,R,F0,A)
% Calculate the principal component information interpretation ability
[Rdx,RdX,RdXt,Rdy,RdY,RdYt] =plsrd(E0,F0,T,A)

% (3) Examine the correlation between the first principal components
% Draw a t1/u1 graph to intuitively examine the correlation between the first principal components
cr=plsutcor(U,T)

%(4) Find the coefficients of the PLS regression equation
% First find the empirical regression coefficient of the standardized dependent variable on the principal component t1
TCOEFF=R(:,1)% This set of coefficients is stored in the last output variable R of the plspcr function
% Standardized dependent variable The empirical regression coefficient of the standardized independent variable
SCOEFF=pls(1,5,W,P,R)% 1 represents the number of principal components used for modeling, 5 represents the number of independent variables
%, finally find the original dependent variable Regarding the empirical regression coefficient of the original independent variable
[COEFF,INTERCEP]=plsiscoeff(X,Y,SCOEFF)% Perform inverse standardization on the standardized regression coefficient, and output the regression coefficient and constant term of the original independent variable to the dependent variable

%(5) The importance of variable projection analysis and model improvement
VIP=plsvip(W,RdY,RdYt,1)% The value obtained represents the ability of the j-th independent variable to explain the dependent variable. If it is smaller, delete the independent variable. Variable remodeling

Guess you like

Origin blog.csdn.net/ccsss22/article/details/113852302