linfit - Determines the linear relation between two variables

SYNOPSIS

linfit  [ parameter=value ... ]  [ inputfile ... ]

Parameters are: x_var, y_vars, printout

DESCRIPTION

The function linfit determines the linear relationship between pairs of variables, e.g. y = slope * x + bias. x_var is a single variable representing x in the above relationship, and y_vars can be specified to be one or more sets of y values. Both the x and y variables specified must be in the same TeraScan dataset and must have the same type and dimensions.

NOTE: the algorithm assumes that errors exist in both the x and y variables and therefore minimizes the distance perpindicular from each point to the regression line (see REFERENCES).

For each x-y pair, linfit outputs the following information:

Mean         Mean values of x, y, slope and bias
Stand Dev    Standard deviations of x, y, slope and bias
Correlation  Correlation between x and y
Count        Number of data points in the y variables
Good         Number of good points in common between x and y

PARAMETERS

x_var

Specifies the x variable.

There is no default.

y_vars

Specifies the y variables to use in determining the linear relationship against x. A linear relation and its corresponding output is produced for each y variable specified. If the list is preceded by a minus sign, then all variables, except those listed, are included. Wildcards * and ? are allowed. If the y_var list happens to include the x variable, this variable is filtered out by the processing and no corresponding output is printed for this x,y (i.e. x,x) pair.

The default is to include all variables.

printout

Whether or not to send the printout to the standard printer. Valid responses are [yes, no].

The default is no.

EXAMPLES

This example uses a dataset with four variables representing temperature and specific humidity at the sea surface and low-level atmosphere. These variables are denoted: Ts, Qs, Ta, Qa. The linear regression is computed for Qs, Qa, Ta against Ts.

% linfit bndlayer.tdf
x_var          : char( 31) ? Ts
y_vars         : char(255) ? []
printout       : char(  3) ? [no]
Linear Fit  Page 1

bndlayer.tdf    Ts              Qa              Bias            Slope
Mean            20.2394         12.1777         -0.050745       0.604188
Stand. Dev.     8.07105         5.04592         2.18954         0.00342603
Correlation     0.927116
Good            5082
Count           16200

bndlayer.tdf    Ts              Qs              Bias            Slope
Mean            20.2733         16.2691         0.258171        0.789754
Stand. Dev.     8.03644         6.38559         1.67935         0.00259728
Correlation     0.973736
Good            5055
Count           16200

bndlayer.tdf    Ts              Ta              Bias            Slope
Mean            20.1032         19.17           -1.77989        1.04211
Stand. Dev.     8.16278         8.50055         1.79828         0.00269242
Correlation     0.982929
Good            5249
Count           16200

SEE ALSO

spectral, dimcorr, binavg, xcorrel, polyfit, correlate, regress, stats.

REFERENCES

York, D., 1966: Least-Squares Fitting of a Straight Line. Canadian Journal of Physics, Vol. 44, 1079-1086. Kermack, K. A. and J. B. S. Haldane, 1950: Biometrika, Vol. 37, 30.


Last Update: $Date: 1998/05/29 18:33:03 $