User's Guide

LSQMTB

To perform a least squares fit on columns of an IBIS tabular file.

Function:

Performs a least squares fit on columns of an image based information system (IBIS) tabular file. The coefficients and/or the residuals may be placed in specified columns of the tabular file.


Reference: 

G. Golub, "Numerical Methods For Solving Linear Least
Squares Problems," Numerische Mathematik, Vol.7, ISS.3 
(1965), pp. 206 - 216.

Parameters:

INFILE
Input file. Input IBIS tabular file. The independent, dependent, and group values are read from the specified columns of this file; whereas, the coefficients and the residuals are written to the COEFCOL and RESCOL columns of this file.

The maximum number of rows per group is dependent upon the number of columns specified in INDCOL. If the maximum number of columns (35) is specified, the maximum number of rows in a group is 936.

INDCOL
Independent column(s). The column(s) that contain the independent points for the least squares fit.

DEPCOL
Dependent column. The column that contains the dependent points for the least squares fit.

COEFCOL(-- )
Coefficient columns. The columns of the IBIS tabular file in which the solution coefficients of each of the independent columns of the least squares fit are placed.

RESCOL(-- )
Residual column. The column of the IBIS tabular file in which the residuals are placed.

GRPCOL(-- )
Group column. The column of the IBIS tabular file which are used to group rows based on the occurrence of sequential identical values within the column. A separate least squares fit is performed for each group found. If defaulted, one least squares fit is performed for all the rows in the file. The current limit on the number of groups is 450.

If GRPCOL is specified, MTBSORT should be executed first with the column that is specified in GRPCOL as the primary column.

Examples:

  1. LAS> lsqmtb infile=in.dat indcol=(5,6,21) depcol=8 coefcol=(9,10,11) rescol=12 grpcol=--

    Columns 5, 6, and 21 of IN.DAT are the independent variables of the least squares fit; whereas, column 8 contains the dependent variables. A least squares fit is performed on all the rows of IN.DAT, placing the solution coefficients of column 5 in column 9, the solution coefficients of column 6 in column 10, and the solution coefficients of column 21 in column 11. The residuals are placed in column 12. After all the rows have been written, the completion message is displayed.

  2. LAS> lsqmtb infile=in.dat indcol=(5,6,21) depcol=7 rescol=19 grpcol=25

    Columns 5, 6, and 21 of IN.DAT are the independent variables of the least squares fit; whereas, column 7 contains the dependent variables. A separate least squares fit is performed on the rows within each group of IN.DAT placing the residuals in column 19. A group is formed for every set of sequential identical numbers found in column 25. After all the rows have been written, the completion message is displayed.

Description/Algorithm:

The program begins with the standard initialization and retrieval of user-specified parameters. If specified, the rows are grouped according to the sequential identical numbers found in column GRPCOL. The values of the columns specified by INDCOL and DEPCOL for the rows found in each group are used to calculate the least squares fit for that group. If GRPCOL is not specified, the values of the columns specified by INDCOL and DEPCOL of all the rows are used to calculate the least squares fit. The solution coefficients and/or the residuals are placed in the columns specified. When all the rows have been written to the output file, the IBIS tabular file is closed and the completion message is displayed.

Nonfatal Error Message:

  1. [lsqmtb-close] Error closing <XXXXX> file

    An error was encountered while closing the <XXXXX> file. The data may still be valid.

Fatal Error Messages:

  1. [lsqmtb-array] No. of rows and columns are too large

    The number of rows in the IBIS tabular file for a specific group and the number of columns specified in INDCOL are too large for the allocated array space. Respecify the number of columns or create a smaller group.

  2. [lsqmtb-fatal] Fatal error encountered

    A fatal error was encountered during processing. The output IBIS tabular file may or may not be valid. The message that is displayed immediately preceding this message is the specific error that was encountered.

  3. [lsqmtb-open] Error opening <XXXXX> file

    An error was encountered while trying to open the <XXXXX> file. Verify that the file exists.

  4. [lsqmtb-ngroup] The number of groups has been exceeded

    The number of groups has exceeded 450 groups. Reduce the number of groups.

  5. [lsqmtb-write] Error writing to the output file

    An error was encountered while trying to write to the IBIS tabular file. Check the format of the file.

User Notes:

  1. There can only be 450 groups.