Re: [R] ts or xts with high-frequency data within a year

2016-03-31 Thread Bert Gunter
TYPO on TYPO! It should be X[,3] Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Mar 31, 2016 at 9:47 AM, Bert Gunter wrote: > Inline. > > B

Re: [R] ts or xts with high-frequency data within a year

2016-03-31 Thread Bert Gunter
Inline. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Mar 30, 2016 at 5:37 PM, Ryan Utz wrote: > Bill, Josh, and Bert, > > Thanks for your responses. I

Re: [R] ts or xts with high-frequency data within a year

2016-03-31 Thread Giorgio Garziano
Ryan, >From "decompose()" source code, two conditions can trigger the error message: "time series has no or less than 2 periods" based on the frequency value, specifically: 1. f <= 1 2. length(na.omit(x)) < 2 * f It appears to me that your reproducible code has got a typo error, it shou

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread William Dunlap via R-help
decompose wants frequency(Y) to be more than 1 - it really wants an integer frequency so it can return a vector of that length containing the repeating pattern (the "figure"). frequency(Y) is 1/3600 so you get the error (which might be better worded): > plot(decompose(Y)) Error in decompose(Y

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Ryan Utz
Bill, Josh, and Bert, Thanks for your responses. I still can't quite get this when I use actual dates. Here's an example of what is going wrong: X=as.data.frame(1:6000) X[2]=seq.POSIXt(ISOdate(2015,11,1),by='hour',length.out=6000) X[3]=sample(100,size=6000,replace=T) Y=xts(X[,3],order.by=X[,2])

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread William Dunlap via R-help
You said you specified frequency=96 when you constructed the time series, but when I do that the decomposition looks reasonable: > time <- seq(0,9,by=1/96) # 15-minute intervals, assuming time unit is day > measurement <- sqrt(time) + 1/(1.2+sin(time*2*pi)) + rnorm(length(time),0,.3) > plot(decomp

[R] ts or xts with high-frequency data within a year

2016-03-30 Thread Ryan Utz
Sorry about not providing code; I didn't think to just simulate dummy code. Here's a situation where I have <1 year of data, hourly time sampling, and the error that I get using my actual data: ### X=as.data.frame(1:6000) X[2]=seq.POSIXt(ISOdate(2015,11,1),by='hour',length.out=6000) X[3]=sample(

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Joshua Ulrich
On Wed, Mar 30, 2016 at 10:29 AM, Bert Gunter wrote: > I "think" the problem is that you failed to set the "frequency" > attribute of your time series, so it defaults to 1. A time series with > one observation per period cannot be decomposed, since the error term > is confounded with the "seasonal

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Bert Gunter
I "think" the problem is that you failed to set the "frequency" attribute of your time series, so it defaults to 1. A time series with one observation per period cannot be decomposed, since the error term is confounded with the "seasonality", which is essentially your error message. Again, a guess

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Bert Gunter
Code please. Reproducible example?(e.g. 1st 100 values) "PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code." Bert Gunter "The trouble with having an open mind is that people keep coming along and sticki

[R] ts or xts with high-frequency data within a year

2016-03-30 Thread Ryan Utz
Hello, I have a time series that represents data sampled every 15-minutes. The data currently run from November through February, 8623 total readings. There are definitely daily periodic trends and non-stationary long-term trends. I would love to decompose this using basic time series analysis. H