[R] Fractional degree of differencing, d

Fologo Dubois fologodubois at yahoo.com
Thu Mar 3 13:07:41 CET 2011


Formula: 
Memory Index called delta in Parzen(1983); see pdf attachment p.536
 
Code:
 
##########################################################################
# I am using a simulated long memories time series X1 of length 2000;    #
# I actually used d=.25 for AFRIMA (0,.25,0)                             #
# and I am trying to estimate d through the memory index discussed in    #
# Parzen(1983) on p.536 . I am in need of an assessment of my code for   #
# the Parzen window as well as the choice of k and n. in my code I used  #
# k to be 999 and n to be 2000. I am not confortable with the memory     #
#  index estimator and I will appreciate some help on the the code.      #
#                           Thank you!                                   #
##########################################################################
 
Pt <- acf(X1,2000)
n <- length(X1)
vv <- 1:(n-1)
T <- 2000
MT <- T/2
MT2 <- MT%/%2

## Parzen window formula on p.536
M_vT <- KK <- as.numeric(0)
M_vT = vv/MT
for (v in vv) {
        K[v] <- if (v <= MT2) 
            1 - 6 * M_vT[v]^2 * (1 - M_vT[v])
        else if ( v <= MT) 
            2 * (1 - M_vT[v])^3
        else 0
    }
## Non-parametric kernel spectral density estimator formula on p.536
 p  = Pt$acf
 P = g = 0
 for (v in 1:999) {
 g = g + (K[v]*p[v])
 P[v] = g
 }
w  <- seq(.005, 1, by = .005)
i.c <- sqrt(as.complex(-1))
g.w <- 0
f.w <- function(w){
 for (v in 1:999) {
 g.w = g.w+ P[v]*exp(-2*pi*i.c*w*v)
    }
 g.w
 }
# f.w(.015) for w=.015 for instance
## memory index delta formula on p.536
g.d = 0
j = 1:999
j1 = j/n
j2 = 1000/n
f1 = f.w(j1)
f2 = f.w(j2)
delta = 0
deltak = 0
for (i in 1:999){ 
 g.d = g.d + (log(f1[i]) - log(f2))
   }
  delta = g.d
 
 deltak = delta/999



      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Parzen(1983).pdf
Type: application/pdf
Size: 1132008 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110303/b9319cbb/attachment-0001.pdf>


More information about the R-help mailing list