Code covered by the BSD License  

Highlights from

Be the first to rate this file! 19 Downloads (last 30 days) File Size: 5.44 KB File ID: #27918 Version: 1.7




16 Jun 2010 (Updated )

Geometric Mean Regression (Reduced Major Axis Regression).

| Watch this File

File Information

Model II regression should be used when the two variables in the regression equation are random and subject to error, i.e. not controlled by the researcher. Model I regression using ordinary least squares underestimates the slope of the linear relationship between the variables when they both contain error. According to Sokal and Rohlf (1995), the subject of Model II regression is one on which research and controversy are continuing and definitive recommendations are difficult to make.
GMREGRESS is a Model II procedure. It standardize variables before the slope is computed. Each of the two variables is transformed to have a mean of zero and a standard deviation of one. The resulting slope is the geometric mean of the linear regression coefficient of Y on X. Ricker (1973) coined this term and gives an extensive review of Model II regression.
[B,BINTR,BINTJM] = GMREGRESS(X,Y,ALPHA) returns the vector B of regression coefficients in the linear Model II and a matrix BINT of the given confidence intervals for B by the Ricker (1973) and Jolicoeur and Mosimann (1968)-McArdle (1988) procedure.

GMREGRESS treats NaNs in X or Y as missing values, and removes them.

Syntax: function [b,bintr,bintjm] = gmregress(x,y,alpha)

Required Products Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
29 Mar 2014 Antonio Trujillo-Ortiz

The slope sign bug was efficiently corrected thanks to the valuable suggestions given by Holger Goerlitz and Joel E. Cohen. Yes, a negative slope are always negative!

Antonio Trujillo-Ortiz

Comment only
13 Feb 2012 Holger Goerlitz

Thank you very much, very well done and works great.

A quick comparison with the rma.m by Edward T. Peltzer ( gives identical results.

Except for one error, I believe: gmregress always returns a positive slope, even for data with a negative trend. After correcting the slope by (compare to rma.m):

si = r/abs(r); % sign of correl. coeff.

b = si*b;

negative slopes are negative.

Thanks for the function again,

Comment only
13 Jan 2011 Pete

Pete (view profile)

Well documented. Appears to work as advertised.

I would invite somebody to compare and contrast this script with the scripts by Edward T. Peltzer hosted at:

(which encouragingly produce identical slopes)

Comment only
17 Jun 2010 1.1

It was added an appropriate format to cite this file.

17 Jun 2010 1.3

Text was improved.

18 Jun 2010 1.4

Text was improved.

01 Apr 2014 1.6

A bug were removed. We are grateful for the valuable suggestions given by Holger Goerlitz and Joel E. Cohen.

02 Apr 2014 1.7

Code was improved.

Contact us