Skip to content

Newey-West Long-run variance

1 message · Jose Iparraguirre D'Elia

#
Thanks Matthieu. I had been poring over the sandwich library, but can't get around to estimating what I need. 
Could you or any one else in the list help me with the following? 
I am reproducing here Example 9 (Long-run variance of AR(1)) from Zivot and Wang (2001). They use the function asymp.var which unfortunately doesn't seem to be available in R (if anyone has an R code for this function, I'd be greatly appreciate it).
How can I replicate these results in R? In particular, the Newey-West estimate for the long-run variance of the series (=0.269)? 
Perhaps the answer lies within the package sandwich, but I can't get through the crust enough to find any pleasure yet...
Thanks, in advance,
Jos?


Example 9 - Long-run variance of AR(1)

Let yt be an AR(1) process created using
Here ?(1) = 1/?(1) = 1/1?? 

and

lrv(yt)= ?2/(1 ? ?)2 

For ? =0.75, ?2 =1, lrv(yt)=16 implies for T = 100 an asymptotic
standard error for ? y equal to SE(?y)=0.40.If yt ~ WN(0, 1), then the
asymptotic standard error for ?y is SE(?y)=0.10.

lrvAR(yt) may be easily computed in S-PLUS using OLS to estimate the
AR(1) parameters:
[1] 13.75

Here lrvAR(yt)=13.75, and an estimate for SE(?y) is SEAR(?y)=0.371.

The S+FinMetrics function asymp.var may be used to compute the
nonparameteric Newey-West estimate lrvNW(yt). The arguments expected
by asymp.var are
function(x, bandwidth, window = "bartlett", na.rm = F)
where x is a ?timeSeries?, bandwidth sets the truncation lag MT in (3.20)
and window specifies the weight function. Newey and West suggest setting
the bandwidth using the sample size dependent rule
MT =4(T/100)^2/9, which is equal to 4 in the present case. 

The Newey-West long-run variance estimate is then
[1] 7.238

and the Newey-West estimate of SE(?y) is SENW(?y)=0.269.

Reference:

Zivot, E. and Wang, J. (2002). Modelling Financial Time Series with
S-PLUS. 



-----Original Message-----
From: Matthieu Stigler [mailto:matthieu.stigler at gmail.com] 
Sent: 22 February 2009 18:03
To: Jose Iparraguirre D'Elia
Cc: r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] Newey-West Long-run variance

see package sandwich

Jose Iparraguirre D'Elia a ?crit :