function [predictedValue] = swRegression(testSet, trainSet)

% apply stepwise regression beginning with no terms in the model and using
% entrance/exit tolerances of 0.05/0.10 on the p-values:
[myCoefficients,se,pval,selectedColumns,stats] = stepwisefit(trainSet(:,1:(size(trainSet,2)-1)),trainSet(:,size(trainSet,2)),'penter',0.05,'premove',0.10,'display','off');

% only keep the selected columns' coefficients
% selected ones are multiplied by one and the unselected ones by zero
myCoefficients = (myCoefficients.*selectedColumns');

predictedValue = abs(testSet(1,(1:size(testSet,2)-1)) * myCoefficients + stats.intercept);

end