## Julia Essentials

; We add ; to suppress output returned. For example let’s compare two codes with and without ; at the end. x=2 would return 2 in the console as an output while x=2; will not return anything in the console. enumerate() enumerate() returns both the index and the value of an element in an array. collect(enumerate(countries)) Output: (1, "Korea") (2, "Japan") (3, "China") countries = ("Korea", "Japan", "China") for (index, country) in enumerate(countries) println("Country $(country) in index$(index)") end Output:...

April 22, 2023 · 1 min · 97 words · Me

## Matrix Decomposition

Matrix decomposition example Let N be the number of possible simulated paths, T be the number of time periods, and P be the number of parameters to estimate. For now, let’s suppose that N = 4, T=2 and P=2. Below is an example with T-by-N matrix. The rows indicates different time periods, and the columns indicate different simulated paths $$n \in \{1,2,3,4\}$$. For example, $$A = \begin{bmatrix} a_{11}\theta + b_{11}\rho & a_{12}\theta + b_{12}\rho & a_{13}\theta + b_{13}\rho & a_{14}\theta + b_{14}\rho \newline \beta(a_{21}\theta + b_{21}\rho) & \beta(a_{22}\theta + b_{22}\rho) & \beta(a_{23}\theta + b_{23}\rho) & \beta(a_{24}\theta + b_{24}\rho) \end{bmatrix} \newline$$ When n =1, $$\begin{bmatrix} 1 & \beta \end{bmatrix} \begin{bmatrix} a_{11} & b_{11} \newline a_{21} & b_{21} \end{bmatrix} \begin{bmatrix} \theta \newline \rho \end{bmatrix}$$ When n =2, $$\begin{bmatrix} 1 & \beta \end{bmatrix} \begin{bmatrix} a_{12} & b_{12} \newline a_{22} & b_{22} \end{bmatrix} \begin{bmatrix} \theta \newline \rho \end{bmatrix}$$ When n =3, $$\begin{bmatrix} 1 & \beta \end{bmatrix} \begin{bmatrix} a_{13} & b_{13} \newline a_{23} & b_{23} \end{bmatrix} \begin{bmatrix} \theta \newline \rho \end{bmatrix}$$ When n =4, $$\begin{bmatrix} 1 & \beta \end{bmatrix} \begin{bmatrix} a_{14} & b_{14} \newline a_{24} & b_{24} \end{bmatrix} \begin{bmatrix} \theta \newline \rho \end{bmatrix}$$...

April 21, 2023 · 3 min · 447 words · Me