Artificial time series data¶
x <- round(rnorm(1:12),1)
ts(x,start=2000,
frequency=4)
Qtr1 Qtr2 Qtr3 Qtr4
2000 0.3 1.0 -0.1 0.9
2001 1.8 0.0 -0.7 1.6
2002 0.2 -0.9 -0.8 -0.1
print(ts(x,start=2000,
frequency=12))
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2000 0.3 1.0 -0.1 0.9 1.8 0.0 -0.7 1.6 0.2 -0.9 -0.8 -0.1
The data file “unemployment.csv” used below consists of data originally downloaded from the OECD Database website.
unemployment <- read.csv("unemployment.csv")
# This is of course incorrect, but demonstrates how monthly multivariate time
# series can be constructed from scratch.
ts(unemployment[2:5],
start = 1970,
frequency=4)
Germany France Italy Netherlands
1970 Q1 0.557 2.477 4.000 0.868
1970 Q2 0.689 2.712 4.001 1.213
1970 Q3 0.912 2.806 4.711 2.114
1970 Q4 1.000 2.690 4.691 2.151
1971 Q1 2.132 2.853 3.942 2.624
1971 Q2 3.965 4.028 4.312 3.772
1971 Q3 3.934 4.406 4.925 4.067
1971 Q4 3.822 4.938 5.261 3.916
1972 Q1 3.661 5.191 5.313 3.827
1972 Q2 3.192 5.833 5.658 3.648
1972 Q3 3.190 6.246 5.574 4.015
1972 Q4 4.505 7.396 6.269 5.818
1973 Q1 6.441 8.041 6.918 8.519
1973 Q2 7.921 8.253 7.694 10.987
1973 Q3 7.932 9.660 8.504 10.604
1973 Q4 8.002 10.234 8.611 9.191
1974 Q1 7.661 10.373 9.896 8.394
1974 Q2 7.611 10.479 10.248 7.982
1974 Q3 7.598 9.975 10.451 7.785
1974 Q4 6.863 9.348 10.214 6.917
1975 Q1 6.203 8.866 9.127 5.965
1975 Q2 6.653 9.439 8.593 5.469
1975 Q3 7.672 10.358 8.835 5.401
1975 Q4 8.849 11.704 10.239 6.546
1976 Q1 9.560 12.225 11.291 7.587
1976 Q2 9.386 11.544 11.983 7.109
1976 Q3 10.318 12.291 12.092 6.654
1976 Q4 11.412 12.438 12.251 5.590
1977 Q1 11.530 11.910 11.997 5.096
1977 Q2 11.118 11.279 11.762 4.802
- R file: artificial-timeseries.R
- Rmarkdown file: artificial-timeseries.Rmd
- Jupyter notebook file: artificial-timeseries.ipynb
- Interactive version of the Jupyter notebook (shuts down after 60s):
- Interactive version of the Jupyter notebook (sign in required):