The Matlab scripts in MultiRegressLines.matlab run a two-line-segment regression on a dataset of X,Y data, and analyze the uncertainties in that regression via Monte Carlo (since it's a nonlinear problem).
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


MultiRegressLines.matlab, 2002-2015
Andy Ganse, Applied Physics Laboratory, University of Washington

MultiRegressLines includes the Matlab script regress2lines.m that runs a two-line-segment regression on a dataset of X,Y data. Sometimes called "multi-phase linear regression" in the literature, the idea is that N linear segments are joined at their endpoints so that the procedure must estimate not only N standard linear regressions but also the locations of the join point (N=2 here). Unlike the present Java version of the algorithm, this one is mathematically correct and also provides uncertainty analysis of the solution. From regress2lines.m one could create a regress3lines.m script - I may do that in future. Meanwhile, in addition the second script stats_regress2lines.m runs a Monte Carlo analysis to explore the estimate uncertainties in solving for the line parameters and join point (Monte Carlo because the problem is nonlinear).

Please see my webapge explaining the details of this topic: