[R] Help using smooth.spline with zoo object

2009-04-04 Thread Rob Denniker
Can someone please show me how to smooth time series data that I have in the form of a zoo object? I have a monthly economies series and all I really need is to see a less jagged line when I plot it. If I do something like s - smooth.spline(d.zoo$Y, spar = 0.2) plot(predict(s,index(d.zoo)),

Re: [R] Help using smooth.spline with zoo object

2009-04-04 Thread Gabor Grothendieck
Try this: library(zoo) library(lattice) z - as.zoo(EuStockMarkets) xyplot(z) # original xyplot(z, type = smooth) # smooth In zoo see ?xyplot.zoo and in lattice see ?panel.xyplot On Sat, Apr 4, 2009 at 3:19 PM, Rob Denniker bearmarketsr...@inbox.com wrote: Can someone please show me how to

Re: [R] Help using smooth.spline with zoo object

2009-04-04 Thread roger koenker
For equally spaced observations this is quite simple and available in various packages but I like Gabor Grothendieck's version (which didn't come up immediately in my Rseek search: hpfilter - function(y,lambda=1600) eye - diag(length(y)) solve(eye+lambda*crossprod(diff(eye,d=2)),y)}