Monterey Bay Aquarium Research Institute
Edward T. Peltzer
Model I and Model II Regressions

MATLAB® shell-scripts for linear regression analysis

  • Model I regressions
    • lsqfity - Standard Model I linear regression
      • [Y-on-X regression]
      • Fit line by minimizing y-residuals only
      • All data points are given equal weight
      • Use whenever X is controlled and Y is measured
    • lsqfitx - Alternate or Reversed Model I regression
      • [X-on-Y regression]
      • Fit line by minimizing x-residuals only
      • All data points are given equal weight
    • lsqfityw - Weighted Model I regression
      • [wY-on-X regression]
      • Fit line by minimizing y-residuals only
      • Data points are given varying weight
      • Use whenever X is controlled and Y is measured with varying uncertainty
      • Please note that:
        • This m-file gives the correct results for all parameters (Bevington and Robinson,1992); but,
        • the uncertainties in the slope and intercept are much smaller than the same uncertainties calculated by lsqfity.m or lsqfitxi.m (see the results table).
    • lsqfityz - Weighted Model I regression - revised Jan 2000
      • [zY-on-X regression]
      • This is the same regression as lsqfityw.m, except that:
        • York's (1966) equations for the uncertainties in weighted slope and intercept are used.
        • The revised uncertainties are more are more in line with those from lsqfity.m.
  • Model II regressions
    • lsqfitma - Pearson's Major Axis
      • aka: first principal component
      • [Correlation of X & Y]
      • Line is fit by minimizing BOTH x- and y-residuals simultaneously
      • All data are given equal weight
      • Use when units and range of X and Y are the same
    • lsqfitgm - Geometric Mean regression
      • aka: reduced major axis or standard major axis
      • [Correlation of X & Y]
      • Slope of line is the geometric mean of the two slopes determined by regressing Y-on-X and X-on-Y
      • All data are given equal weight
      • Use when units or range of X and Y are different
      • Please note that:
        • This algorithm uses both lsqfity.m and lsqfitx.m for determining the slope.
        • The uncertainties in the slope and intercept are estimated by analogy with the symmetrical uncertainty limits for a model I regression following the treatment by Ricker (1973).
    • lsqbisec - Least Squares Bisector
      • [Regression/correlation of X & Y]
      • Slope of line is determined by bisecting the minor angle between the two model I regressions:
        Y-on-X and X-on-Y
      • All data are given equal weight
      • Use when units or range of X and Y are different
      • Please note that:
        • This algorithm uses both lsqfity.m and lsqfitx.m for determining the slope.
        • The uncertainties in the slope and intercept are estimated by analogy with the symmetrical uncertainty limits for a model I regression following the treatment by Ricker (1973).
    • lsqcubic - Least-Squares-Cubic
      • [Regression/correlation of wX & wY.]
      • Line is fit by minimizing both x- and y-residuals simultaneously for WEIGHTED data points.
      • Each data point can be given its own weight either as the inverse-square of the actual measurement precision or as the inverse-square of the product of the relative measurement precision for the method times concentration.
      • Use when the measurement error of X and/or Y varies.
      • Please note that:
        • This algorithm uses lsqfitma.m for the first estimate of the slope.
        • Iteration proceeds until the change in the slope is less than the user defined limit.

  • Download a text version of this page.
Last updated: Feb. 05, 2009
Questions? Comments? Please contact Edward Peltzer.