What does the time index tell us?
Some data are naturally evenly spaced by time. The time series discrete_data
shown in the top figure has 20 observations, with one observation appearing at each of the discrete time indices 1 through 20. Discrete time indexing is appropriate for discrete_data
.
The time series continuous_series
shown in the bottom figure also has 20 observations, it is following the same periodic pattern as discrete_data
, but its observations are not evenly spaced. Its first, second, and last observations were observed at times 1.210322, 1.746137, and 20.180524, respectively. Continuous time indexing is natural for continuous_series
, however, the observations are approximately evenly spaced, with about 1 observation observed per time unit. Let's investigate using a discrete time indexing for continuous_series
.
This exercise is part of the course
Time Series Analysis in R
Exercise instructions
- Use
plot(___, ___, type = "b")
to displaycontinuous_series
versuscontinuous_time_index
, its continuous time index - Create a vector 1:20 to be used as a discrete time index.
- Now use
plot(___, ___, type = "b")
to displaycontinuous_series
versusdiscrete_time_index
- Note the various differences between the resulting figures, but the approximation appears reasonable because the overall trend remained preserved
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plot the continuous_series using continuous time indexing
par(mfrow=c(2,1))
plot(continuous_time_index,___, type = "b")
# Make a discrete time index using 1:20
discrete_time_index <-
# Now plot the continuous_series using discrete time indexing
plot(discrete_time_index,___, type = "b")