I wanted to use STATA for a kalman filter simulation and wanted to go about it the following way
1. Generate iid error terms
$$ {e_t}, {n_t}, {u_t} $$
2. Generate three AR1 process like so
$$ \beta_t = a*b_{t-1} + u_t $$ $$ x_t = c_0 + c_1*x_{t-1} + n_t $$ $$ y_t = b_t*x_t + e_t $$
3. use Kalman filter to predict b_hat
I have been able to use rnorm() to generate the iid error terms, but I am stuck at the second step. I know how to run a state space model to get the kalman filter estimates but AR1 has really tripped me up.