Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/notebooks/Chapter 14 - Applications to Dynamic System.ipynb
Views: 449
Systems of First-Order Difference Equations
In time series analysis, we study difference equations by writing them into a linear system. For instance,
We define
Rerrange the difference equation for better visual representation,
The difference equation can be rewritten as
That is,
In general, we make sure the difference equation look like:
then rewrite as , where
And also
Markov Chains
Markov chain is a type of stochastic process, commonly modeled by difference equation, we will be slightly touching the surface of this topic by walking through an example.
Markov chain is also described by the first-order difference equation , where is called state vector, is called stochastic matrix.
Suppose there are 3 cities , and , the proportion of population migration among cities are constructed in the stochastic matrix below
For instance, the first column means that of population will stay in city , will move to city and will migrate to city . The first row means of city 's population will immigrate into , of city 's population will immigrate into .
Suppose the initial population of 3 cities are , convert the entries into percentage of total population.
Input the stochastic matrix
After the first period, the population proportion among cities are
The second period
The third period
We can construct a loop till , then plot the dynamic path. Notice that the curve is flattening after 20 periods, and we call it convergence to steady-state.
Eigenvalue and -vector in Markov Chain
If the in last example is diagonalizable, there will be linearly independent eigenvectors and corresponding eigenvalues, ,...,. And eigenvalues can always be arranged so that .
Also, because any initial vector , we can use the basis of eigenspace (eigenvectors) to represent all .
This is called eigenvector decomposition of . Multiply by
In general, we have a formula for
Now we test if has linearly independent eigvectors.
is diagonalizable, which also means that has linearly independent eigvectors.
First we find the , i.e.
Now we can use the formula to compute , it is the same as we have plotted in the graph.
This is close enough to the steady-state.
Fractal Pictures
Here is an example of fractal geometry, illustrating how dynamic system and affine transformation can create fractal pictures.
The algorithem is perform 4 types of affine transformation. The corresponding probabilites are .
The codes below are self-explanatory.