The TS_COEF function computes the coefficients φ1, φ2, ... , φP used in a P-th order autoregressive time-series forecasting model. This routine is written in the IDL language. Its source code can be found in the file ts_coef.pro in the lib subdirectory of the IDL distribution.

Examples


; Define an n-element vector of time-series samples:
X = [6.636.596.466.496.456.416.386.266.095.99, $
     5.925.935.835.825.955.915.815.645.515.31, $
     5.365.175.074.975.005.014.854.794.734.76]
; Compute the coefficients of a 5th order autoregressive model:
PRINT, TS_COEF(X, 5)

IDL prints:

1.30168    -0.111783    -0.224527     0.267629    -0.233363

Syntax


Result = TS_COEF( X, P [, /DOUBLE] [, MSE=variable] )

Return Value


Returns a P-element vector whose type is identical to X.

Arguments


X

An n-element single- or double-precision floating-point vector containing time-series samples.

P

An integer or long integer scalar that specifies the number of coefficients to be computed.

Keywords


DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

MSE

Set this keyword to a named variable that will contain the mean square error of the P‑th order autoregressive model.

Version History


4.0

Introduced

See Also


TS_FCAST