## Argmax

Today I explore argmax and argmin function defined in Base package. armax returns a maximal index, while argmin returns a minimal index. A = [1 2; 3 4] argmax(A) Output: CartesianIndex(2, 2) B=[-1 2; 10 -10] argmax(B) Output: CartesianIndex(2, 1) argmin(B) Output: CartesianIndex(2, 2) argmax can have a function as the first argument (say f) and the domain of the function (say x) as the second argument and it will still find a value of x that maximizes f(x) ....

May 1, 2023 · 1 min · 92 words · Me

## AR(1) model

Suppose we have following AR(1) model (autoregressive model of order 1) defined by: $$X_{t+1}=aX_t + b+ cW_{t+1}$$ where $$X_0$$ and $$W_{t}$$ are independent, [a,b,c] are scalar-valued parameters, the state space is $$\mathbb{R}$$, the process $$W_{t}$$ is independently distributed and standard normal, and initial condition $$X_0$$ is drawn from the normal distribution of mean $$\mu_0$$ and standard error of $$\nu_0$$. Iterating backward from time $$t$$, we have $$X_t = a^tX_0 + b \sum_{j=0}^{t-1}a^j + c\sum_{j=0}^{t-1}a^jW_{t-j},$$ which implies that $$X_t$$ depends on parameter [a,b,c], initial condition $$X_0$$, and the sequence of shocks from period 1 throughout t represented by $$W_1, \cdots, W_t$$....

April 27, 2023 · 2 min · 250 words · Me