[R] Fractional degree of differencing, d

From: Fologo Dubois <fologodubois_at_yahoo.com>
Date: Thu, 03 Mar 2011 04:07:41 -0800 (PST)


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Mar 2011 - 15:13:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Mar 2011 - 15:20:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive