This function creates a representation of a discrete time series that can be further processed by model estimation functions.
Details
The discrete time series x can be a vector of numeric, character, factor or
logical type. If the state space of the series is not specified, that is when
vals is NULL, it is computed in a way that depends on the type of x:
for a factor,
valsis set to thelevels()ofx;for a logical vector,
valsis set toc(FALSE, TRUE);for other types,
valsis set to all the unique values taken by the time series (as returned bysort(unique(x))).
If vals is specified, the function makes sure that x contains only the
specified values and reports an error otherwise. The state space vals may
include values that do not appear in x.