0

I would like to smooth a zoo time series (a zoo object) in R. I've already performed the classic moving average smoothing, but I would like to try other methods, such as the kernel smoothing or others, but nothing seems to work, because the function returns a list and NOT a zoo time series! So, when I try to plot it, I can't.

data.smoothKER <- ksmooth(time(data), data, "normal", bandwidth = 3)
plot(data.smoothKER, datazoo)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' and 'y' lengths differ 

What can I do?

Phil
  • 7,287
  • 3
  • 36
  • 66
  • 1
    It would be helpful if you could post a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and describe the kind of output you want – Giulio Centorame Oct 13 '22 at 10:45
  • If the question is how to create a zoo series from `K <- ksmooth(...)` then `z <- read.zoo(data.frame(K))` – G. Grothendieck Oct 13 '22 at 13:11

0 Answers0