At Mark 24: | tau and maxit where made optional |
Open in the MATLAB editor: g02lb_example
function g02lb_example fprintf('g02lb example results\n\n'); n = 15; x = zeros(n,n); x(:,1:8) = ... [-2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 1.9607, -1.6324; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 1.9607, -1.6324; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 0.0744, -1.7333; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 0.0744, -1.7333; -2.6931, -2.5271, -1.2871, 2.8369, 1.4092, -3.1398, 0.0744, -1.7333; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, -4.7548, 3.6521; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 0.0744, -1.7333; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 2.4064, 1.7438; -2.6931, -2.5271, -1.2871, 0.0744, -1.7333, 0.0902, 0.0744, -1.7333; 2.2261, -5.3648, 0.3049, 3.0777, 0.3891, -0.0701, 0.0744, -1.7333; -4.1921, -1.0285, -0.9801, 3.0777, 0.3891, -0.0701, 0.0744, -1.7333; -4.9217, 1.2977, 0.4473, 3.0777, 0.3891, -0.0701, 0.0744, -1.7333; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, 2.2261, -5.3648; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, -4.9217, 1.2977; -2.6931, -2.5271, -1.2871, 3.0777, 0.3891, -0.0701, -4.1921, -1.0285]; x(:,9:n) = ... [ 0.5746, 1.9607, -1.6324, 0.5740, 2.8369, 1.4092, -3.1398; 0.5746, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 1.9607, -1.6324, 0.5746, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.8524, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, -1.2201, 0.8829, 2.2253; 1.1057, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.0902, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; 0.3049, 2.2261, -5.3648, 0.3049, 2.8369, 1.4092, -3.1398; 0.4473, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398; -0.9801, 0.0744, -1.7333, 0.0902, 2.8369, 1.4092, -3.1398]; y = [ 0; 0.28; 0.2; 0.51; 0.11; 2.73; 0.18; 1.53; -0.1; -0.52; 0.4; 0.3; -1; 1.57; 0.59]; isx = ones(n, 1, 'int64'); iscale = int64(1); xstd = zeros(n, 1); ystd = [0]; maxfac = int64(4); % Fit a PLS model [xbar, ybar, xstd, ystd, xres, yres, w, p, t, c, u, xcv, ycv, ifail] = ... g02lb( ... x, isx, y, iscale, xstd, ystd, maxfac); % Display results disp('x-loadings, P'); disp(p); disp('x-scores, T'); disp(t); disp('y-loadings, C'); disp(c); disp('y-scores, U'); disp(u); fprintf('Explained variance\n'); fprintf(' Model effects Dependent variable(s)\n'); fprintf('%12.6f %12.6f\n',[xcv(1:maxfac) ycv(1:maxfac,1)]');
g02lb example results x-loadings, P -0.6708 -1.0047 0.6505 0.6169 0.4943 0.1355 -0.9010 -0.2388 -0.4167 -1.9983 -0.5538 0.8474 0.3930 1.2441 -0.6967 -0.4336 0.3267 0.5838 -1.4088 -0.6323 0.0145 0.9607 1.6594 0.5361 -2.4471 0.3532 -1.1321 -1.3554 3.5198 0.6005 0.2191 0.0380 1.0973 2.0635 -0.4074 -0.3522 -2.4466 2.5640 -0.4806 0.3819 2.2732 -1.3110 -0.7686 -1.8959 -1.7987 2.4088 -0.9475 -0.4727 0.3629 0.2241 -2.6332 2.3739 0.3629 0.2241 -2.6332 2.3739 -0.3629 -0.2241 2.6332 -2.3739 x-scores, T -0.1896 0.3898 -0.2502 -0.2479 0.0201 -0.0013 -0.1726 -0.2042 -0.1889 0.3141 -0.1727 -0.1350 0.0210 -0.0773 -0.0950 -0.0912 -0.0090 -0.2649 -0.4195 -0.1327 0.5479 0.2843 0.1914 0.2727 -0.0937 -0.0579 0.6799 -0.6129 0.2500 0.2033 -0.1046 -0.1014 -0.1005 -0.2992 0.2131 0.1223 -0.1810 -0.4427 0.0559 0.2114 0.0497 -0.0762 -0.1526 -0.0771 0.0173 -0.2517 -0.2104 0.1044 -0.6002 0.3596 0.1876 0.4812 0.3796 0.1338 0.1410 0.1999 0.0773 -0.2139 0.1085 0.2106 y-loadings, C 3.5425 1.0475 0.2548 0.1866 y-scores, U -1.7670 0.1812 -0.0600 -0.0320 -0.6724 -0.2735 -0.0662 -0.0402 -0.9852 0.4097 0.0158 0.0198 0.2267 -0.0107 0.0180 0.0177 -1.3370 -0.3619 -0.0173 0.0073 8.9056 0.6000 0.0701 0.0422 -1.0634 0.0332 0.0235 -0.0151 4.2143 0.3184 0.0232 0.0219 -2.1580 -0.2652 0.0153 0.0011 -3.7999 -0.4520 0.0082 0.0034 -0.2033 -0.2446 -0.0392 -0.0214 -0.5942 -0.2398 0.0089 0.0165 -5.6764 0.5487 0.0375 0.0185 4.3707 -0.1161 -0.0639 -0.0535 0.5395 -0.1274 0.0261 0.0139 Explained variance Model effects Dependent variable(s) 16.902124 89.638060 29.674338 97.476270 44.332404 97.939839 56.172041 98.188474