regress, correlate - Computes linear relationships between variables

SYNOPSIS

regress  [ parameter=value ... ]  [ inputfile ... ]
correlate  [ parameter=value ... ]  [ inputfile ... ]

Parameters for regress are: indep_var, depend_vars, add_const, printout.

Parameters for correlate are: include_vars, printout.

DESCRIPTION

Given a list of user specified variables, correlate computes normalized correlation coeffients for each possible pairing. The formula for the correlation between variables var[j] and var[k] is

SUMi ((var[j][i] - mean of var[j]) * (var[k][i] - mean of var[k])) ------------------------------------------------------------ std_deviation of var[j] * std_deviation of var[k]

The normalized correlation of any variable with itself is 1.

Given an independent variable, and a list of dependent variables, regress computes linear regression coefficients for each of the dependent variables, and optionally, a constant term:

indep_var = coef[0] + SUMj ( coef[j]*depend_var[j] )

For each coefficient, regress computes an estimate of its variance. regress also computes the variance of the solution, e.g., sum of squared errors in the above equation, divided by the size of the independent variable.

Both correlate and regress can repeat this process for several input datasets. All variables specified for correlate or regress must be parallel, e.g., have the same dimensions.

PARAMETERS

indep_var
Independent variable for regress. Can be specified using wildcards like * or ?, but must unambiguously refer to exactly one variable. There is no default.
depend_vars
List of dependent variables for regress. Can be specified using wildcards like * or ?. If the list of prefixed with a minus sign, all variables except those listed will be used as dependent variables. The independent variable should not be among the dependent variables. There is no default.
add_const
Indicates whether to use a constant term in regress. Possible answers are yes and no. The default is yes.
include_vars
List of variables to use in correlate. If the list is prefixed with a minus sign, all variables except those listed are used by correlate. Wildcards * and ? are allowed. The default is to use all variables.
printout
Indicates whether or not to direct the output of regress or correlate to the printer. Possible answers are yes and no. The default is no.

EXAMPLES

The following example show regress and correlate used against a simple test dataset containing three single precision float point variables, x, y, z such that z = 10 + x + y.

%
% printvar test
include_vars   : char(255) ? []
line_per_elem  : char(  3) ? [yes]
list_dims      : char(  3) ? [yes]
printout       : char(  3) ? [no]
Printvar  test  Page 1

                       x               y               z
       1              10               1              21
       2              10               2              22
       3              10               3              23
       4              10               4              24
       5              10               5              25
       6              20               1              31
       7              20               2              32
       8              20               3              33
       9              20               4              34
      10              20               5              35
%
% regress test
indep_var      : char(255) ? z
depend_vars    : char(255) ? x y
add_const      : char(  3) ? [yes]
printout       : char(  3) ? [no]
Regression  Page 1

Count    Variable       Coefficient    Variance

10       z                           4.54747e-14  test
10       x                        1       0.004
10       y                        1        0.05
10       1                       10        1.45
%
% correlate test
include_vars   : char(255) ? []
printout       : char(  3) ? [no]
Correlation  Page 1

Count    Variable 1      Variable 2        Correlation

10       x               y                        0 test
10       x               z                  0.96225
10       y               z                 0.272166
%

SEE ALSO

linfit


Last Update: $Date: 1998/05/29 20:19:48 $