Whoops, fixed a typo: library("zoo") data = c(50, 32, 22, 13, 14, 6, 12, 3, 6, 21, NA, NA, 15, 13, 17, 9, 11, 34, 63) dataz = zoo(data, 1:length(data)) datat = as.ts(dataz) datatt = ts(datat, frequency=2) frequency(datatt) length(datatt) # these all give errors stl(datatt, s.window="per") # this next error is especially bizarre to me, because datatt is periodic with more than two periods stl(datatt, s.window="per", na.action=F) stl(datatt, s.window="per", na.action=na.omit) stl(datatt, s.window="per", na.action=na.pass) stl(datatt, s.window="per", na.action=na.exclude) stl(dataz, s.window="per", na.action=F) stl(datat, s.window="per", na.action=F)
On Wed, Jan 19, 2011 at 2:21 PM, Adam Oliner <oli...@gmail.com> wrote: > The objective is to get the stl calls to work without making up values for > the NAs: > > library("zoo") > data = c(50, 32, 22, 13, 14, 6, 12, 3, 6, 21, NA, NA, 15, 13, 17, 9, 11, > 34, 63) > dataz = zoo(data, 1:length(data)) > t = as.ts(dataz) > datat = as.ts(dataz) > datatt = ts(t, frequency=2) > frequency(datatt) > length(datatt) > # these all give errors > stl(datatt, s.window="per") > # this next error is especially bizarre to me, because datatt is periodic > with more than two periods > stl(datatt, s.window="per", na.action=F) > stl(datatt, s.window="per", na.action=na.omit) > stl(datatt, s.window="per", na.action=na.pass) > stl(datatt, s.window="per", na.action=na.exclude) > stl(dataz, s.window="per", na.action=F) > stl(datat, s.window="per", na.action=F) > > I was expecting at least one of the stl calls to work, because stl claims > to require a ts object with a frequency greater than one and at least two > periods (which I gave it) and it claims to handle NA values. > > > > On Wed, Jan 19, 2011 at 1:59 PM, Gabor Grothendieck < > ggrothendi...@gmail.com> wrote: > >> On Wed, Jan 19, 2011 at 4:27 PM, Adam Oliner <oli...@gmail.com> wrote: >> > My series was regularly spaced, it simply contained missing values. I >> don't >> > see why the new values were added. >> > >> > Besides, my previous email showed exactly how to convert a zoo object >> with >> >> Please provide a minimal self-contained reproducible example (as per >> last line on every r-help message) and explain what you were expecting >> that is different than what you got and we may be able to say more. >> >> >> >> -- >> Statistics & Software Consulting >> GKX Group, GKX Associates Inc. >> tel: 1-877-GKX-GROUP >> email: ggrothendieck at gmail.com >> > > > > -- > - Adam J. Oliner > -- - Adam J. Oliner [[alternative HTML version deleted]] ______________________________________________ R-help@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.