ROBOSVD
Name
robosvd
Purpose (one Line Only)
Robust SVD linear regression fit using mysvdfit
Description
Category
Function fitting
Calling Sequence
Result = ROBOSVD(X, Y, M)
Inputs
X: A vector representing the independent variable. If this an array,
the columns are taken to be the precomputed independant vectors
and no actual function is computed here.
Y: Dependent variable vector. This vector should be same length
as X.
M: The number of coefficients in the fitting function. For
polynomials, M is equal to the degree of the polynomial + 1.
Optional Input Parameters
Weight: A vector of weights for Y(i). This vector should be the same
length as X and Y.
If this parameter is ommitted, 1 is assumed. The error for
each term is weighted by Weight(i) when computing the fit.
Frequently, Weight(i) = 1./Sigma(i) where Sigma is the
measurement error or standard deviation of Y(i).
Funct: A string that contains the name of an optional user-supplied
basis function with M coefficients. If omitted, polynomials
are used.
The function is called:
R = FUNCT(X,M)
where X is an N element vector, and the function value is an
(N, M) array of the N inputs, evaluated with the M basis
functions. M is analogous to the degree of the polynomial +1
if the basis function is polynomials. For example, see the
function COSINES, in the IDL User Library, which returns a
basis function of:
R(i,j) = cos(j*x(i)).
For more examples, see Numerical Recipes, page 519.
The basis function for polynomials, is R(i,j) = x(i)^j.
Keyword Input Parameters
BAD - byte array of the same length as Y. If 0, value is considered
good and used in the fit. If 1, value is considered bad and
is not used. If additional points are seen as bad by this
program, then those flags are modified in the input array.
SILENT - Suppress all printed output.
Outputs
SVDFIT returns a vector of M coefficients.
Keyword Output Parameters
NOTE: In order for an optional keyword output parameter
to be returned, it must be defined before calling SVDFIT.
The value or structure doesn't matter. For example:
YF = 1 ;Define output variable yf.
C = SVDFIT(X, Y, M, YFIT = YF) ;Do SVD, fitted Y vector is now
;returned in variable YF.
YFIT: Vector of calculated Y's.
CHISQ: Sum of squared errors multiplied by weights if weights
are specified.
COVAR: Covariance matrix of the coefficients.
VARIANCE: Sigma squared in estimate of each coeff(M).
SINGULAR: The number of singular values returned. This value should
be 0. If not, the basis functions do not accurately
characterize the data.
Common Blocks
Side Effects
Restrictions
Procedure
Modification History
Written by Marc W. Buie, Lowell Observatory, 2004/07/07
2005/02/17, MWB, added NFINAL keyword
2005/02/22, MWB, added BAD keyword
2005/06/21, MWB, added error trapping keyword