SUBROUTINE ACFAR(NP,RX,BETA,SIGMA) C This routine finds the AR(p) representation corresponding to a positive C definite autocovariance function for lags 0 through p, by solving the C Yule-Walker equations. It is the inverse of ARACF. C Positive definiteness of the autocovariance function is not checked! C Inputs: C NP Parameter p C RX Autocovariance function C Outputs: C BETA(j) Coefficient on lag j in autoregression C SIGMA Standard deviation of innovation IMPLICIT REAL*8 (A-H,O-Z) PARAMETER(LD=100) COMMON/SCRA/V1(LD),V2(LD),A1(LD,LD),A2(LD,LD) DIMENSION RX(0:NP),BETA(NP) CALL DCOPY(NP,RX(0),1,V1,1) CALL DCOPY(NP-1,RX(1),1,V1(NP+1),1) CALL DLSLTO(NP,V1,RX(1),1,BETA) SIGMA=DSQRT(RX(0)-DDOT(NP,RX(1),1,BETA,1)) RETURN END SUBROUTINE ARACF(NP,BETA,SIGMA,RX) C This routine finds the autocovariance function for lags 0 through p, C corresponding to an AR(p) representation, by solving the system of p+1 C linear equations. It is the inverse of ACFAR. C Invertibility of the AR(p) representation is not checked! C Inputs: C NP Parameter p C BETA(j) Coefficient on lag j in autoregression C Outputs: C RX(j) Autocovariance at lag j C SIGMA Standard deviation of innovation IMPLICIT REAL*8 (A-H,O-Z) PARAMETER(LD=100) COMMON/SCRA/V1(LD),V2(LD),A1(LD,LD),A2(LD,LD) DIMENSION RX(0:NP),BETA(NP) NP1=NP+1 CALL UMISET(NP1,A1,LD) DO 10 I=1,NP1 DO 10 K=1,NP J=1+IABS(K+1-I) 10 A1(I,J)=A1(I,J)-BETA(K) CALL DSET(NP,0.0D0,V1(2),1) V1(1)=SIGMA**2 CALL DLSLRG(NP1,A1,LD,V1,1,RX) RETURN END