MATLAB code accompanying Master Thesis "Regime Switching Models and the Mental Accounting Framework"