Regular Calendar Time Series Objects

DESCRIPTION:
Defines a regular univariate or multivariate time series object with calendar dates associated with the observations.

USAGE:
cts(x, start = dates("01/01/60"), units = "years",
    k.units  =  1, frequency = 1, names  =  NULL)
is.cts(x)

REQUIRED ARGUMENTS:
x:
a vector, matrix, or data frame containing the data values for the time series.

OPTIONAL ARGUMENTS:
start:
starting date for the series. This can be an an object of class "dates", a character string of the form "mm/dd/yy", or an integer representing a Julian date. Default is January 1, 1960.
units:
one of the strings "days", "weeks", "months", "quarters", or "years", representing the units in which the interval between observations is measured.
k.units:
integer giving the number of units between observations. This allows bi-weekly data, for example, to be specified in a compact way.
frequency:
integer giving the sampling frequency; that is, how many observations per sampling period. S-PLUS assumes a period of one year for calendar data. The frequency is assumed to be tightly related to the argument units, for example, monthly data are assumed to have frequency=12. See the DETAILS section for the default relationships between units and frequency.
names:
(multivariate data only): a vector of character strings to be used as names for the component series of the multivariate series. The default is to use the dimnames for x if x is a matrix or a data frame, or the strings "Series 1", "Series 2", ..., etc. if dimnames(x) = NULL. In the case of data frames, names overrides existing column names.

VALUE:
The cts function returns an object of class "cts" whose data values are given by x. The resulting series is considered regularly spaced.

The is.cts function returns TRUE if x is of class "cts" and FALSE otherwise.


DETAILS:
This function is provided for the user who wants to keep calendar information as corresponding observation times and take advantage of objects of class "dates" in the formatting, input, and output of, and operations on these times.

Time units are important in defining a calendar time series. The following table describes the default values of frequency and for the different values of units accepted in the actual implementation:

units frequency

"days" 365 "weeks" 52 "months" 12 "quarters" 4 "years" 1

When k.units is given, the figures above are divided by its value to provide the correct values of frequency(x) and deltat(x) under the same assumption of a yearly cycle. For example, bi-weekly data then will have a sampling frequency of 52/2 = 26 samples per year.

To change the length of the sampling cycle, you must provide a value for frequency. This will not change the dates of the observation times. For instance, if you have units="months" and frequency=3, you get a cycle of three observations every three months; if you have units="months", k.units=2 and frequency=3, you get a cycle of three observations every six months. The cycle function will return a values based on the frequency that you provide.


SEE ALSO:
cycle , dates , deltat , frequency , its , rts , units .

EXAMPLES:
 monthly.rain
<- cts(rgamma(59, 3)*(1.5+cos((1:59)-1/12*2*pi)),
                    start = dates("01/01/93"), units =  "months")

# Bi-weekly Maximum Temperature temp <- cts(rgamma(110, 65), start = dates("01/15/93"), units = "weeks", k = 2)