Chapter1 Programming R
Chapter1 Programming R
course!
T I M E S E R I E S A N A LY S I S I N R
David S. Matteson
Associate Professor at Cornell University
Introduction
Time Series: A sequence of data in chronological order.
Data is commonly recorded sequentially, over time.
print(BMW_data)
...
1996-07-08 0.002
1996-07-09 -0.006
1996-07-10 -0.016
1996-07-11 -0.020
1996-07-14 -0.006
1996-07-15 -0.014
1996-07-16 0.002
1996-07-17 -0.001
...
Autoregression (AR)
1Throughout this course, you will not only be learning how to use R for time
series analysis and forecasting, you will also learn several models for time
David S. Matteson
Associate Professor at Cornell University
Sampling frequency: exact
Some time series data is exactly evenly spaced.
1 24
David S. Matteson
Associate Professor at Cornell University
Building ts() objects - I
Start with a vector of data time_series <- ts(data_vector)
plot(time_series)
Apply the ts() function
data_vector
10 6 11 8 10 3 6 9
plot(time_series)
is.ts(data_vector)
FALSE
is.ts(time_series)
TRUE
Improved plotting.