On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | . |
Open in the MATLAB editor: g02dk_example
function g02dk_example fprintf('g02dk example results\n\n'); x = [1, 0, 0, 0; 0, 0, 0, 1; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 1, 0, 0; 0, 0, 0, 1; 1, 0, 0, 0; 0, 0, 1, 0; 1, 0, 0, 0; 0, 0, 1, 0; 0, 1, 0, 0]; y = [33.63; 39.62; 38.18; 41.46; 38.02; 35.83; 35.99; 36.58; 42.92; 37.80; 40.43; 37.89]; [n,m] = size(x); isx = ones(m,1,'int64'); mean_p = 'M'; ip = int64(m+1); % Fit general linear regression model [rss, idf, b, se, covar, res, h, q, svd, irank, p, wk, ifail] = ... g02da(mean_p, x, isx, ip, y); % Display initial estimate results fprintf('Initial estimates\n\n'); fprintf('Residual sum of squares = %12.4e\n', rss); fprintf('Degrees of freedom = %4d\n', idf); fprintf('\nVariable Parameter estimate Standard error\n\n'); ivar = double([1:ip]'); fprintf('%6d%20.4e%20.4e\n',[ivar b se]'); % Constraints c = ones(ip,ip-irank); c(1,1) = 0; % Re-estimate using constraints [b, se, covar, ifail] = g02dk( ... p, c, b, rss, idf); % Display constrined estimates fprintf('\nEstimates using constraints\n\n'); fprintf('Variable Parameter estimate Standard error\n\n'); ivar = double([1:ip]'); fprintf('%6d%20.4e%20.4e\n',[ivar b se]');
g02dk example results Initial estimates Residual sum of squares = 2.2227e+01 Degrees of freedom = 8 Variable Parameter estimate Standard error 1 3.0557e+01 3.8494e-01 2 5.4467e+00 8.3896e-01 3 6.7433e+00 8.3896e-01 4 1.1047e+01 8.3896e-01 5 7.3200e+00 8.3896e-01 Estimates using constraints Variable Parameter estimate Standard error 1 3.8196e+01 4.8117e-01 2 -2.1925e+00 8.3342e-01 3 -8.9583e-01 8.3342e-01 4 3.4075e+00 8.3342e-01 5 -3.1917e-01 8.3342e-01