I'm trying to learn about new-keynesian models hw they were derived. However, I found great difficulty in deriving the equations used in many studies and the lack of books and papers that mention their origin. The following equation (see link slide 7/26, https://slideplayer.com/slide/10639387/) represents the aggregate demand block of the canonical gap model (reduced-form new-keynesian model) which is a s follows,
$$\hat{y}_t = a_1 \hat{y}_{t-1} - a_2 mci_t + a_3 \hat{y}_{t+1} + \epsilon^y_t,$$ $$mci_t = a_4 \hat z_t + (1 - a_4) \hat r_t.$$
Where $\hat y_t$ is the output gap, $mci_t$ represents the monetary conditions index, $\hat r_t$ refers to the real interest rate gap, $\hat z_t$ denotes the real exchange rate gap. Can anyone please show how such equation was derived or direct me to its source. Thanks in advance.