[R] Creating time series (ts) object

R. Michael Weylandt michael.weylandt at gmail.com
Mon Feb 6 23:25:25 CET 2012


The documentation doesn't say what you think it says:

"The value of argument ‘frequency’ is used when the series is
     sampled an integral number of times in each unit time interval.
     For example, one could use a value of ‘7’ for ‘frequency’ when the
     data are sampled daily, and the natural time period is a week, "

If your "natural time period" is a year, then there are 365 samples
per time period and that's your frequency. Of course, this might have
problems with leap days: good luck with that.

Michael

On Mon, Feb 6, 2012 at 3:53 PM, Filoche <pmassicotte at hotmail.com> wrote:
> Hi everyone.
>
> I have have a dataset with daily measurement from January 1st of 1966 up to
> December 31th of 2011.
>
> Here's the first part of the data:
>
> Date    SLEV
> 1/1/1966        1.086
> 1/2/1966        1.079
> 1/3/1966        1.133
> 1/4/1966        1.261
> 1/5/1966        1.391
> 1/6/1966        1.571
> 1/7/1966        1.728
> 1/8/1966        1.823
> 1/9/1966        1.97
> 1/10/1966       1.804
> 1/11/1966       2.02
> 1/12/1966       2.017
> 1/13/1966       1.86
> 1/14/1966       1.96
> 1/15/1966       1.813
> 1/16/1966       1.773
> 1/17/1966       1.647
> 1/18/1966       1.634
> 1/19/1966       1.815
> 1/20/1966       1.928
> 1/21/1966       1.937
> 1/22/1966       2.187
> 1/23/1966       2.133
> 1/24/1966       2.162
> 1/25/1966       2.026
> 1/26/1966       2.055
> 1/27/1966       2.051
> 1/28/1966       1.998
> 1/29/1966       2.178
> 1/30/1966       1.709
> 1/31/1966       1.79
> ...
> 12/31/2011      0.599
>
>
> I would like to perform some sort of time series analysis. To do so, I'm
> trying to create a ts() object with my data. However, I'm not sure how ti
> create it and what frequency to use. In the help file, they say to use
> /*frequency = 7*/ for daily observation, but the result don't seems
> coherent:
>
> */Series:
> Start = c(1966, 1)
> End = c(4337, 5)
> Frequency = 7/ *
>
> Anyone can help me?
>
> Thank is advance,
> Phil
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Creating-time-series-ts-object-tp4362762p4362762.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list