Help for the OLSQ routine.

I. Description

The OLSQ routine is a Mathematica port of the instrinsic speakeasy ordinary least squares regression routine. The routine i svery helpful for quickly assessing the importance of certain wavelengths in a spectrum or certain princiapl components in a PCR analysis. For information of how to use it in Speakeasy see the help files that came with Speakeasy.

The model that is fit is:

y = m1(x1) + m2(x2) + .... + C

with one independent variable for each column of the independentvariables matrix.

II. The format of the call

In Mathematica:

output = OLSQ[independentvariables, dependentvariables, print];

independentvariables --> is be a matrix (a set of spectra with each row being a spectrum and each column being the wavelengths of each spectrum) .

dependentvariables --> is a one dimensional array with one value for each row of the indepentvariable matrix. (i. e. a concentration corresponding to each spectrum).

output --> will be a list fo three elements which will be:

  1. The best fit coefficients for the model
  2. The predicted results of the model for the input values.
  3. The best fit risiduals of the model


print --> is either a 1 or a 0, if 1 (or left off) then an output table will be generated, if 0 then no output will be generated.

Currently the model is limited to 100 independent variables, but this is arbitrary and a quick glance at the code will reveal how to change it for larger applications.