Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
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 n

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
Gabor, On Wed, Jan 19, 2011 at 3:36 PM, Gabor Grothendieck wrote: > stl does not support series with NAs > Thank you. This is what I needed to know. Cheers, -- - Adam J. Oliner [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Gabor Grothendieck
On Wed, Jan 19, 2011 at 5:21 PM, Adam Oliner 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)

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
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)

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
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 missing values into a ts object with missing values and a frequency other than 1, so I'm not sure what you mean:

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Gabor Grothendieck
On Wed, Jan 19, 2011 at 4:27 PM, Adam Oliner 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 reproducibl

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Gabor Grothendieck
On Wed, Jan 19, 2011 at 4:17 PM, Adam Oliner wrote: > Gabor, > > If you follow those steps on a series with missing values, the resulting tt > will contain tons of new NAs. (See my original email and the call to "zrt = zoo and zooreg classes handle series which may not be regularly spaced whereas

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
Gabor, If you follow those steps on a series with missing values, the resulting tt will contain tons of new NAs. (See my original email and the call to "zrt = as.ts(zr)".) At any rate, I finally managed to finagle a ts with the correct frequency by coercing to ts _twice_ and specifying the freque

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
This still does not give me the desired behavior: > z = zoo(x, order.by=t, frequency=24) > t = as.ts(z) ... inserts 23 NA values between every actual value. This is not correct; the original data has a frequency of 24 and doesn't need one forced upon it during coercion. > z = zoo(x, order.by=t) >

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Gabor Grothendieck
On Wed, Jan 19, 2011 at 3:07 PM, Adam Oliner wrote: > This still does not give me the desired behavior: > >> z = zoo(x, order.by=t, frequency=24) >> t = as.ts(z) > ... inserts 23 NA values between every actual value. This is not correct; > the original data has a frequency of 24 and doesn't need o

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Gabor Grothendieck
On Wed, Jan 19, 2011 at 1:10 PM, Adam Oliner wrote: > I don't seem to have that method: > >> zts = as.ts.zoo(z) > Error: could not find function "as.ts.zoo" > > I'm finding forum posts from people trying to use stl directly with zoo[reg] > functions (despite the documentation specifying ts) but di

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-19 Thread Adam Oliner
I don't seem to have that method: > zts = as.ts.zoo(z) Error: could not find function "as.ts.zoo" I'm finding forum posts from people trying to use stl directly with zoo[reg] functions (despite the documentation specifying ts) but discovering that stl gives errors with NA entries. I encountered s

Re: [R] Semi-Regular Time Series with Missing Values

2011-01-18 Thread Gabor Grothendieck
On Tue, Jan 18, 2011 at 6:33 PM, Adam Oliner wrote: > Hi, > > I'm trying to make a ts object that has both NA values and a frequency other > than 1 (so I can use stl). I've tried all permutations I can think of, but > cannot get the desired (expected?) results. > > The values live in x and the cor

[R] Semi-Regular Time Series with Missing Values

2011-01-18 Thread Adam Oliner
Hi, I'm trying to make a ts object that has both NA values and a frequency other than 1 (so I can use stl). I've tried all permutations I can think of, but cannot get the desired (expected?) results. The values live in x and the corresponding semi-regular time stamps are in t: > library('zoo') >