Credits
Better understandings of the economic world
And most importantly, your curiosities about the unknowns.
2018/09/24
Credits
Better understandings of the economic world
And most importantly, your curiosities about the unknowns.
Final exam (14 points): 50% on implementation, 50% on theory. Last year exam available on moodle. Quite easy.
Two take-home exercises using R (3 points each): Empirical questions. To be published at the end of Oct and end of Nov.
Slides available on moodle https://moodleucl.uclouvain.be/ under the name LECON2031
Lectures: Theory and general ideas. Some discussions about implementations.
Tutorials: user-oriented (how to solve take-home exercises).
Problem 1. Projections may be misleading
Problem 2. Variables may be improperly measured
Problem 3. Their changes are caused by other hidden unmeasruable factors
Problem 4. Predictions are Alchemy type games.
If all these are untrustworthy, what do you believe? No answer to this question. (Perhaps yourself?)
Be interested in the values of the same variables with respect to time: Time series
What is time series?
Time series: a sequence of observations over time.
Time series is to describe the dynamical features.
The growth of information over time.
Do we solve the untrustworthy problem by looking at time series?
No, the problem roots in the deeper layer (in the flow chart it should be the topmost layer).
Other existing ways cannot tackle it either.
But time (and space) is the very few available element that can lift lower dimensional creatures (as human beings) to view their world with the angle from higher dimensions.
The course will equip you with a device using time dimension.
You may still get stuck in this low dimensional observable world.
But at least, you will have an equipment for your further exploration.
The curiosities persist our possibility of leaping into a higher dimension.
| 1. Time Series Data and Programming | 6. Non-stationarity and Integrated process |
| 2. Stationarity | 7. Filters and Seasonality |
| 3. Moving Average Model (MA) | 8. System Identification |
| 4. Auto-Regressive Model (AR) | 9. Vector AR |
| 5. ARMA Modeling | 10. VAR Modeling |
| 11. Kalman Filter |
Reference:
Advanced Reference:
Using R for Introductory Statistics https://cran.r-project.org/doc/contrib/Verzani-SimpleR.pdf
Install
R-Console https://www.r-project.org/
RStudio (IDE for R) http://www.rstudio.com Go to “Download RStudio Desktop”
x = rep(0,20) x
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
x[1] = 0; x[2] = 1
for(t in 3:20){x[t] = x[t-1] + x[t-2]}
x
## [1] 0 1 1 2 3 5 8 13 21 34 55 89 144 233 ## [15] 377 610 987 1597 2584 4181
plot(x)
Current computer programming heavily depends on iterations.
For example, the previous for loop iteration
for(t in 3:20){x[t] = x[t-1] + x[t-2]}
fulfills the Fibonacci sequence \[ x_t = x_{t-1} + x_{t-2}\] from \(x_1=0, x_2=1\) to \(x_{20} = 4181\). Here, time index is the number of iterations.
a = c(90,60,50,55,20,40)
b = c("A","B","C","C","C","C")
c = c(TRUE,TRUE,FALSE,FALSE,FALSE,FALSE) as.numeric(c)
## [1] 1 1 0 0 0 0
mydata = data.frame(a,b,c)
names(mydata) = c("Score","Level","Passed")
mydata
## Score Level Passed ## 1 90 A TRUE ## 2 60 B TRUE ## 3 50 C FALSE ## 4 55 C FALSE ## 5 20 C FALSE ## 6 40 C FALSE
mydata$Score
## [1] 90 60 50 55 20 40
as.matrix(mydata)
## Score Level Passed ## [1,] "90" "A" " TRUE" ## [2,] "60" "B" " TRUE" ## [3,] "50" "C" "FALSE" ## [4,] "55" "C" "FALSE" ## [5,] "20" "C" "FALSE" ## [6,] "40" "C" "FALSE"
matdata = as.matrix(mydata) matdata[1,1]
## Score ## "90"
Several time series data repositories offer R APIs. For example:
Quandl https://www.quandl.com/ (financial and economic data)
WDI: World Development Indicators (World bank) https://data.worldbank.org/products/wdi (Country level data)
Federal Reserve Bank of St.Louis https://fred.stlouisfed.org/
Let’s try to find some time series about the economy of Belgium. https://www.quandl.com/data/WWDI-World-Bank-World-Development-Indicators
library(Quandl)
BE_GDP = Quandl("WWDI/BEL_NY_GDP_PCAP_KN")
tail(BE_GDP, n = 2)
FALSE Date Value FALSE 57 1961-12-31 10422.791 FALSE 58 1960-12-31 9961.546
colnames(BE_GDP)=c("Time", "GDP per Capita")
tail(BE_GDP, n = 2)
FALSE Time GDP per Capita FALSE 57 1961-12-31 10422.791 FALSE 58 1960-12-31 9961.546
plot(BE_GDP)
BE_GDP_new = Quandl("WWDI/BEL_NY_GDP_PCAP_KN", type="xts")
library(dygraphs); dygraphs::dygraph(BE_GDP_new, main = "GDP Per Capita")
set.seed(2018) e = rnorm(250) plot(e); abline(h=0)
y = rep(0,250);
for(t in 1:250){y[t+1]=y[t]+e[t]}
plot(y); abline(h=0)
The previous picture looks quite realistic.
But in fact, it is a seemingly random time series.
It is simulated by some iterative scheme which is completely deterministic.
Proof: If you copy the code and run in your computer, you will get the same exact pattern. It violates the principle of randomness.
“Anyone who attempts to generate random numbers by deterministic means is, of course, living in a state of sin.” John von Neumann
N = rep(0,250); U = rep(0,250); U[1] = 100 # the seed
for(t in 2:250){
U[t] = (1664525 * U[t-1] + 1013904223) %% 2^32
N[t] = sqrt(2*log(U[t]))*sin(2*pi*U[t])}
hist(N)
The Motivation of this course.
The way of understanding the current situation: time and information.