similar to: changing the time base in a ts

Displaying 20 results from an estimated 3000 matches similar to: "changing the time base in a ts"

2013 Oct 23
2
Multivariate time series in R 3 vs R 2
Hello! Recently I got report that my package mar1s doesn't pass checks any more on R 3.0.2. I started to investigate and found the following difference in multivariate time series handling in R 3.0.2 compared to R 2 (I've checked on 2.14.0). Suppose I wish to calculate seasonal component for time series. In case of multivariate time series, I wish to process each column independently.
1999 Dec 16
1
aggregate.ts (PR#376)
I'm having some problems with aggregate.ts, e.g. R> x <- ts(1:20) R> frequency(x) [1] 1 R> aggregate(x, nfreq=1/3) Error in aggregate.ts(x, nfreq = 1/3) : cannot change frequency from 1 to 0.333333333333333 In fact aggregate.ts only accepts a new frequency that is a negative power of two in this example. The problem with the current test for compatible frequencies if
2000 Apr 11
0
aggregate.ts (PR#514)
aggregate.ts does not behave in the same way as the equivalent method aggregate.rts in S-PLUS. In particular it - changes the start of the time series - tends to have a length which is 1 shorter For example: R> x <- ts(1:10) R> aggregate(x, nfreq=0.5, FUN=min) Time Series: Start = 2 End = 8 Frequency = 0.5 [1] 2 4 6 8 S> x <- rts(1:10) S> aggregate(x, nf=0.5, fun = min) [1]
2010 Feb 07
2
predicting with stl() decomposition
Hi mailinglist members, I’m actually working on a time series prediction and my current approach is to decompose the series first into a trend, a seasonal component and a remainder. Therefore I’m using the stl() function. But I’m wondering how to get the single components in order to predict the particular fitted series’. This code snippet illustrates my problem: series <-
1999 Jul 27
3
Preliminary version of ts package
There is now a preliminary version of a time series package in the R-devel snapshots, and we would welcome feedback on it. It is based in part on the packages bats (Martyn Plummer) and tseries (Adrian Trapletti) and in part on code I had or have written. (Thanks for the contributions, Martyn and Adrian!) Some of the existing ts code has been changed, for example to plot multiple time series, so
2005 Jan 12
4
Finding seasonal peaks in a time series....
I have a seasonal time series. I want to calculate the annual mean value of the time series at its peak (say the mean of the three values before the peak, the peak, and the three values after the peak). The peak of the time series might change cycle slightly from year to year. # E.g., nPts <- 254 foo <- sin((2 * pi * 1/24) * 1:nPts) foo <- foo + rnorm(nPts, 0, 0.05) bar <- ts(foo,
2011 Nov 02
1
kernapply.ts
I have a suggestion for kernapply for ts objects. When we choose the option circular=F, the returned series don't have the correct dates. The removed dates are all at the beginning instead of half at the beginning and half at the end. It is particularly useful when we need to smooth the series (or remove a trend using a filter) before estimating a model (like in macroeconomics) or simply
2008 Jan 06
1
aggregate.ts help
Hi, I have a ts object with a frequency of 4, i.e., quarterly data, and I would like to calculate the mean for each quarter. So for example: > ts.data=ts(1:20,start=c(1984,2),frequency=4) > ts.data Qtr1 Qtr2 Qtr3 Qtr4 1984 1 2 3 1985 4 5 6 7 1986 8 9 10 11 1987 12 13 14 15 1988 16 17 18 19 1989 20 If I do this manually, the mean
2005 Jun 03
1
ts.intersect a multivariate and univariate ts
This seems like a FAQ, but I can't figure it out. I have a mv ts object: R > tsp(pg) [1] 1982 2003 1 R > dim(pg) [1] 22 12 and a univariate ts: R > tsp(rw) [1] 1690 1996 1 Yet, when I try to intersect them: R > tsp(ts.intersect(rw, pg)) [1] 1982 2176 1 the process goes awry. How to I get rw and pg to be one ts that runs from 1982 to 1996 and has 13 univariate time
2010 Jul 03
2
Change the frequency of a ts?
I'm trying to convert a column of a table into a ts object. The data is monthly, so I want the ts frequency to be 12. I did this ... > filings.ts = as.ts(Filings.100K, frequency=12) > filings.ts Time Series: Start = 1 End = 311 Frequency = 1 [1] 246.9336 305.6789 ... ... > tsp(filings.ts) [1] 1 311 1 > tsp(filings.ts) <- c(1,311,12) Error in attr(x, "tsp")
2004 Apr 25
1
ts's in lm()
Is this a bug? seasonal.dummies <- function(x, contr=NULL) { # takes a time series and returns a matrix of seasonal dummies for # x. This is almost cycle(x), we only have to make it into a factor # and add suitable level names. # return a matrix which includes a constant! # level names here assumes frequency is 12! cyc <- factor( cycle(x), labels=c("ene","feb",
2009 Nov 20
2
How to setup the tsp attribute of a dataset
Hello, I am wondering how I should set up the tsp attribute (available through attr(x, "tsp")) of a dataset x? Let's assume that x has 100 points, and I want to set the frequency to 4. I tried: > attr(x,"tsp")<-c(1,100,4) Error in attr(x, "tsp") <- c(1, 100, 4) : invalid time series parameters specified Is there any other way to set the frequency of
2012 Aug 09
1
POSIXct to ts
Hi, I have a dataframe (try.1) with  date/time and temperature columns, and the date/time is in POSIXct fomat. Sample included below. I would like to to try decompose () or stl() to look at the trends and seasonality in my data, eventually so that  I can  look at autocorrelation.  The series is 3 years of water temperature with clearly visible seasonal periods. Right now, if I try decompose,
2007 Nov 24
1
patch proposal for plot.ts
Hi all. Currently, if you try: > lag.plot(1:10) you get superposed labels '1' and '10'. Things go worse in more extreme cases: x <- ts(1:10) x1 <- lag(x, 4) plot(x1, x) This is due to a mistake in plot.ts. My suggestion is the following really minimal patch to plot.ts: @@ -530,7 +530,7 @@ plot.ts <- text(xy, labels =
2017 Sep 02
1
Precision error in time index of ts objects
Thanks for the very detailed explanation. I did not create the series using structure(), that was the result of dump() on an intermediate object created within tsdisagg::ta(), which is where I found the error in the first place. ta() indeed manipulates .Tsp directly, rather than using ts. I guess this is a bug in tsdisagg then. Thanks! -- Andrea Altomani On Sat, Sep 2, 2017 at 12:31 AM
2009 Aug 18
1
aggregating values at discreet irregular time intervals into hourly values
Hello R users, I'm a newby to R (and programming software at large) and I would need some help to sum up event data at discreet time and irregular time interval into a hourly frequency. Here is an example of my time series frame (irregular time-serie object - irts in the tseries package): time value 2008-12-19 19:11:03 GMT 1 2008-12-19 19:12:00 GMT 0 2008-12-19
2009 Jun 14
1
time function behavior for ts class objects
Hi all- I am trying to use the time function for ts class objects and do not understand the return value. I want to use it to set up a time trend in arima fits. It does not seem to return a correct linear sequence that matches the underlying time series. I am running: R version 2.8.1 (2008-12-22). For example: R> ## create a time series R> x <- rnorm(24) R> (xts <-
2017 Sep 01
0
Precision error in time index of ts objects
On Fri, 1 Sep 2017, Andrea Altomani wrote: > I should have formulated my question in a more specific way. > > 1. I suspect this is a floating point precision issue. I am not very > knowledgeable about R internals, can someone else confirm it? Yes. If you represent a series with increment 1/12 it depends on how you do it. As a simple example consider the following two descriptions
2017 Sep 01
2
Precision error in time index of ts objects
I have a time series x, and two other series obtained from it: x <- structure(2017, .Tsp = c(2017.41666666667, 2017.41666666667, 12), class = "ts") y <- floor(x) z <- x-y I would expect the three series to have exactly the same index. However I get the following > time(x)-time(y) Jun 2017 0 as expected, but > time(x)-time(z) integer(0) Warning message: In
2003 Apr 07
1
filtering ts with arima
Hi, I have the following code from Splus that I'd like to migrate to R. So far, the only problem is the arima.filt function. This function allows me to filter an existing time-series through a previously estimated arima model, and obtain the residuals for further use. Here's the Splus code: # x is the estimation time series, new.infl is a timeseries that contains new information # a.mle