Multiple linear regression - Input x: Independent variable (dimension x sample) y: Dependent variable (1 x sample) - Output w: Coefficients (1 x dimension) (end of w is bias) Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function w = vb_multiple_regression(x, y) 0002 % Multiple linear regression 0003 % 0004 % - Input 0005 % x: Independent variable (dimension x sample) 0006 % y: Dependent variable (1 x sample) 0007 % 0008 % - Output 0009 % w: Coefficients (1 x dimension) (end of w is bias) 0010 % 0011 % Copyright (C) 2011, ATR All Rights Reserved. 0012 % License : New BSD License(see VBMEG_LICENSE.txt) 0013 0014 xt = [x', ones(size(x,2),1)]; 0015 xx = xt'*xt; 0016 xy = xt'*y'; 0017 w = (xx\xy)'; 0018