* G05PHF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER IP, IQ, N, LR PARAMETER (IP=2,IQ=0,N=10,LR=IP+IQ+6+IP) INTEGER MSEED, MSTATE PARAMETER (MSEED=1,MSTATE=633) * .. Local Scalars .. DOUBLE PRECISION AVAR, VAR, XMEAN INTEGER GENID, I, IFAIL, LSEED, LSTATE, SUBID * .. Local Arrays .. DOUBLE PRECISION PHI(IP), R(LR), THETA(1), X(N) INTEGER SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05PHF * .. Executable Statements .. WRITE (NOUT,*) 'G05PHF 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 SEED(1) = 1762543 * GENID and SUBID identify the base generator GENID = 1 SUBID = 1 * Initialize the generator to a repeatable sequence LSTATE = MSTATE LSEED = MSEED IFAIL = 1 CALL G05KFF(GENID,SUBID,SEED,LSEED,STATE,LSTATE,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99998) IFAIL GO TO 40 END IF * Set up the reference vector and generate the N realisations * Choose MODE = 2 IFAIL = 1 CALL G05PHF(2,N,XMEAN,IP,PHI,IQ,THETA,AVAR,R,LR,STATE,VAR,X,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 40 END IF * Display the variates DO 20 I = 1, N WRITE (NOUT,99999) X(I) 20 CONTINUE * 40 CONTINUE * 99999 FORMAT (1X,F12.4) 99998 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99997 FORMAT (1X,' ** G05PHF returned with IFAIL = ',I5) END