List of Routines By Functionality | MISR Toolkit: Main Page
-Abstract
MTK_LINEAR_REGRESSION_CALC Use linear regression to fit a set of observations (x,y) to the model: y(x) = a + b * x
-Copyright
Copyright (2013), California Institute of Technology.
U.S. Government sponsorship acknowledged.
-I/O
Given:
num number of elements
x x values
y y values
y_sigma uncertainty in y values
the call:
status = MTK_LINEAR_REGRESSION_CALC( num, x, y, y_sigma, a, b, corr )
returns:
status 0 on success; otherwise failure
a variable a
b variable b
corr correlation for linear regression
-Examples
;;
;; Set up input parameters
;;
num = 4
x = [1,5,7,8]
y = [12,14,19,21]
y_sigma = [0.1, 0.2, 0.2, 0.3]
;;
;; The call
;;
status = MTK_LINEAR_REGRESSION_CALC( num, x, y, y_sigma, a, b, corr )
;;
;; Output...
;;
print, '================================================='
print, a, b, corr
IDL outputs:
=================================================
10.696193 0.0000000 0.0000000 0.0000000
1.0944363 0.0000000 0.0000000 0.0000000
0.94802655 0.0000000 0.0000000 0.0000000
-Particulars
None.
-Required Reading
For important details concerning this module's function, please refer to
the MTK routine MtkLinearRegressionCalc.c.
-Version
-IDL-MTK Version 1.2.4