Routine ID: E201 | |
---|---|
Author(s): K.S. Kölbig | Library: MATHLIB |
Submitter: | Submitted: 01.12.1994 |
Language: Fortran | Revised: |
Subroutine subprograms RLSQPM and DLSQPM fit a polynomial
$p$_{m}(x) = ∑_{j=0}^{m}a_{j}x^{j}
of degree m to n equally-weighted data points ($x$_{i},y_{i} ). The calculated coefficients $a$_{j} are such that
$S$_{m}^{2} = ∑_{i=1}^{n}(y_{i}-p_{m}(x_{i}))^{2} = min.
Subroutine subprograms RLSQP1 and DLSQP1 fit a straight line $p$_{1}(x) = a_{0}+a_{1}x to n such points.
Subroutine subprograms RLSQP2 and DLSQP2 fit a parabola $p$_{2}(x) = a_{0}+a_{1}x+a_{2}x^{2} to n such points.
An estimate $s\; =S$_{m}^{2}/(n-m-1)
of the standard deviation $\sigma $ is calculated.
On CDC and Cray computers, the double-precision versions DLSQPM, DLSQP1 and DLSQP2 are not available.
Structure:
SUBROUTINE subprograms
User Entry Names: RLSQPM, RLSQP1, RLSQP2,
DLSQPM, DLSQP1, DLSQP2
External References:
RVSET, DVSET, DVSUM, DVMPY (F002),
DSEQN (F012)
Usage:
For $t=R$ (type REAL), $t=D$ (type DOUBLE PRECISION),
CALL tLSQPM(N,X,Y,M,A,SD,IFAIL) CALL tLSQP1(N,X,Y,A0,A1,SD,IFAIL) CALL tLSQP2(N,X,Y,A0,A1,A2,SD,IFAIL)
Method:
The normal equations are solved. On computers other than CDC or Cray, double-precision mode arithmetic is used internally for RLSQPM, RLSQP1 and RLSQP2.
Notes:
Meaningful results can usually be obtained only for small values of m (typically $<10$ ).
References: