* G05PAF Example Program Text * Mark 20 Release. NAG Copyright 2001. * .. Parameters .. INTEGER IP, IQ, N, NR PARAMETER (IP=2,IQ=0,N=10,NR=IP+IQ+5+IP) INTEGER NOUT PARAMETER (NOUT=6) * .. Local Scalars .. DOUBLE PRECISION AVAR, VAR, XMEAN INTEGER I, IFAIL, IGEN, MODE * .. Local Arrays .. DOUBLE PRECISION PHI(IP), R(NR), THETA(1), X(N) INTEGER ISEED(4) * .. External Subroutines .. EXTERNAL G05KBF, G05PAF * .. Executable Statements .. WRITE (NOUT,*) 'G05PAF Example Program Results' WRITE (NOUT,*) * Set the ARMA model parameters XMEAN = 0.0D0 PHI(1) = 0.4D0 PHI(2) = 0.2D0 AVAR = 1.0D0 * Initialize the seed to a repeatable sequence ISEED(1) = 1762543 ISEED(2) = 9324783 ISEED(3) = 4234401 ISEED(4) = 742355 * IGEN identifies the stream. IGEN = 1 CALL G05KBF(IGEN,ISEED) MODE = 0 IFAIL = 1 * Set up the reference vector CALL G05PAF(MODE,XMEAN,IP,PHI,IQ,THETA,AVAR,VAR,N,X,IGEN,ISEED,R, + NR,IFAIL) IF (IFAIL.EQ.0) THEN MODE = 1 * Generate a sample of 10 observations IFAIL = -1 CALL G05PAF(MODE,XMEAN,IP,PHI,IQ,THETA,AVAR,VAR,N,X,IGEN,ISEED, + R,NR,IFAIL) IF (IFAIL.EQ.0) THEN DO 20 I = 1, N WRITE (NOUT,99999) X(I) 20 CONTINUE END IF ELSE WRITE (NOUT,99998) IFAIL END IF * 99999 FORMAT (1X,F12.4) 99998 FORMAT (1X,' ** G05PAF returned with IFAIL = ',I5) END