Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of sllinrega
Home > sltoolbox > regression > sllinrega.m

sllinrega

PURPOSE ^

SLLINREGA Performs Augmented Multivariate Linear Regression

SYNOPSIS ^

function [A, b] = sllinrega(X, Y, varargin)

DESCRIPTION ^

SLLINREGA Performs Augmented Multivariate Linear Regression

 $ Syntax $
   - [A, b] = sllinrega(X, Y, ...)

 $ Arguments $
   - X:        The sample matrix of x
   - Y:        The sample matrix of y
   - A:        The solved transform matrix
   - b:        The solved shift vector

 $ Description $
   - [A, b] = sllinrega(X, Y, ...) solves the regression problem given
     by the following formula:
           y = A * x + b
     in least square error sense. The samples are stored in X and Y
     in column-wise manner.
     You can specify properties for regression as in sllinreg.

 $ Remarks $
   - The implementation is based on sllinreg with an augmented 
     formulation as follows:
           y = [A, b] * [x; 1]

 $ History $
   - Created by Dahua Lin, on Sep 15th, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • sllinreg SLLINREG Performs Multivariate Linear Regression and Ridge Regression
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
This function is called by:

SOURCE CODE ^

0001 function [A, b] = sllinrega(X, Y, varargin)
0002 %SLLINREGA Performs Augmented Multivariate Linear Regression
0003 %
0004 % $ Syntax $
0005 %   - [A, b] = sllinrega(X, Y, ...)
0006 %
0007 % $ Arguments $
0008 %   - X:        The sample matrix of x
0009 %   - Y:        The sample matrix of y
0010 %   - A:        The solved transform matrix
0011 %   - b:        The solved shift vector
0012 %
0013 % $ Description $
0014 %   - [A, b] = sllinrega(X, Y, ...) solves the regression problem given
0015 %     by the following formula:
0016 %           y = A * x + b
0017 %     in least square error sense. The samples are stored in X and Y
0018 %     in column-wise manner.
0019 %     You can specify properties for regression as in sllinreg.
0020 %
0021 % $ Remarks $
0022 %   - The implementation is based on sllinreg with an augmented
0023 %     formulation as follows:
0024 %           y = [A, b] * [x; 1]
0025 %
0026 % $ History $
0027 %   - Created by Dahua Lin, on Sep 15th, 2006
0028 %
0029 
0030 %% parse and verify input arguments
0031 
0032 if nargin < 2
0033     raise_lackinput('sllinrega', 2);
0034 end
0035 
0036 if ~isnumeric(X) || ~isnumeric(Y) || ndims(X) ~= 2 || ndims(Y) ~= 2
0037     error('sltoolbox:invalidarg', ...
0038         'The X and Y should be both 2D numeric matrices');
0039 end
0040 
0041 %% main
0042 
0043 % augment formulation
0044 [dx, nx] = size(X);
0045 Xa = [X; ones(1, nx)];
0046 
0047 % solve
0048 Aa = sllinreg(Xa, Y, varargin{:});
0049 clear Xa;
0050 
0051 % extract
0052 A = Aa(:, 1:dx);
0053 b = Aa(:, dx+1);
0054 
0055 
0056 
0057 
0058 
0059 
0060

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com