function [swregdataset] = mySWReg(dataset)

% 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(dataset(:,1:(size(dataset,2)-1)),dataset(:,size(dataset,2)),'penter',0.05,'premove',0.10,'display','off');

% copy the selected columns
swregdataset = [];
for i =1:size(selectedColumns,2)
   if selectedColumns(i) == 1
      swregdataset = [swregdataset,dataset(:,i)]; 
   end    
end

% append the last cost column at the end
swregdataset = [swregdataset,dataset(:,size(dataset,2))];

end