📄 powerpls.m
字号:
function m = powerpls(x,y,lv,powers);
%POWERPLS Continuum regression using Wise-Ricker power method
% This function calculates regression vectors using the
% continuum regression method developed by Wise and Ricker
% that is based on taking the singular values of the x-block
% to some power and then applying conventional PLS. This
% method thus allows for adjustment of the balance between
% describing the input block variance versus obtaining a
% correlation with the output block. The inputs are the
% matrix of predictor variables (x), vector or matrix of
% predicted variables (y), the maximum number of latent
% variables to consider (lv) and the row vector of powers
% to be considered (powers). The output is the matrix of
% regression vectors or matrices (m) starting with 1 LV and
% the first power. The I/O format is
% m = powerpls(x,y,lv,powers);
%
% Note: PLS = 1, high powers go towards the PCR solution,
% low powers towards MLR. This routine may become unstable for
% high powers (greater than 4-8).
% Copyright
% Barry M. Wise
% 1991
% Modified May 1994
[mx,nx] = size(x);
if mx >= nx
[u,s,v] = svd(x,0);
else
[ut,st,vt] = svd(x',0);
u = vt;
s = st';
v = ut;
end
[mp,np] = size(powers);
clc
for j = 1:np
home
mesg = sprintf('Now working on model %g out of %g.',j,np);
disp(mesg)
if powers(1,j) == 1.0
xp = x;
scl = diag(ones(1,min([mx nx])));
else
xp = u*(s.^powers(1,j))*v';
scl = diag(diag(s.^powers(1,j))./diag(s));
end
[P,Q,W,T,U,b,ssqdif] = pls(xp,y,lv);
cm = cumsum(conpred(b,W,P,Q,lv));
scores = cm*v;
temp = scores*scl*v';
if j == 1
m = temp;
else
m = [m; temp];
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -