[R] Hodrick-Prescott-Filter as smooth.spline
Albrecht Kauffmann
alkauffm at rz.uni-potsdam.de
Mon Jul 8 12:05:25 CEST 2002
Could someone, please, write me, how to compute the spar-value for the
smooth.spline-routine to get the same HP-filtered time-series with a
parameter lambda for a function (see mail "Hodrick-Prescott-Filter
example" from ggrothendieck at yifan.net):
hpf <- function(y,lambda{
eye <- diag(length(y))
d <- diff(eye,d=2)
z <- solve(eye+lambda*crossprod(d),y)}
?
Second, is there a connection between the parameter lambda in this
function and the value $lambda of the smooth.spline routine?
For annual time series with smooth.spline(y,spar=0.71205) I get almost
the same $y-values like with the program above and lambda=100, but I would
like to know the reason for this.
With many thanks in advance
Albrecht Kauffmann
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list