This code shows how to estimate a two-stage flexible least square method that both deal with the instability of the parameters and the endogeneity in the equation.
As a case study, we have used this model to estimate a forward-looking Taylor rule policy function for the Central Bank of the Republic of Turkey.
Two_Stage_FLS.R is the main file that produces results. Two_Stage_FLS_Functions.R includes necessary function to estimate a flexible least squares method.
You can read the working paper from here.