⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plsrsgn.m

📁 偏最小二乘算法在MATLAB中的实现
💻 M
字号:
function coeff = plsrsgn(data,lv)
%PLSRSGN Generates a matrix of PLS models for MSPC
%  This function constructs a matrix of PLS models that
%  can be used like a PCA model for multivariate statistical
%  process control (MSPC) purposes. Given a data matrix (data)
%  a PLS model is formed using (lv) latent variables that relates
%  each variable to all the others. The PLS model regression
%  vectors are collected in an output matrix (coeff) which
%  can be used like the I=PP' matrix in PCA.
%  I/O format is: coeff = plsrsgn(data,lv);

%  Copyright Eigenvector Technologies 1995
%  Modified by N.B. Gallagher October 1995

[m,n] = size(data);
if lv >= n
  error('Number of latent variables must be < number of variables.')
end
coeff = -eye(n);
clc
for i = 1:n
  home
  s = sprintf('The PLS model results follow for variable number %g',i);
  disp(s)
  [P,Q,W,T,U,b,ssqdif] = pls([data(:,1:i-1) data(:,i+1:n)],data(:,i),lv);
  m = conpred(b,W,P,Q,lv);
  if lv>1
    cm = (sum(m))';
  else
    cm = m';
  end
  for j = 1:n-1
    if i>j
      coeff(j,i) = cm(j,1);
    end
    if i<=j
      coeff(j+1,i) = cm(j,1);
    end
  end
end
coeff = -1*coeff;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -