Question

The hybrid New Keynesian Phillips Curve is:

model

After a few manipulations, we obtain the following estimable model:

new model

where π is inflation rate and x is a measure of output gap (= the cyclical component of GDP using the Hodrick-Prescott filter). The explanatory variables of the model π and x are observable.

I am required to estimate this model using nonlinear least squares; however, this model looks linear to me. Also, my attempts to use the nls() function in R have failed.

Also, my research on nonlinear regression led me to logistic population growth, but I'm not able to find a way to relate what I learnt to this exercise, especially when it comes to deriving the starting values.

Was it helpful?

Solution

Using ordinary least squares (OLS) with the lm() function to estimate equation (2) in the question would lead to the estimation of the coefficients coef1, coef2 and coef3.

On the other hand, using nonlinear least squares with the nls() function to estimate the equation would estimate values for the parameters 'a', 'b' and 'c', which are the parameters of interest.

The nls() function (nonlinear least squares) in R has two important parameters: First, the formula parameter and then the start parameter. Running ?nls in R will provide some details; however, the gist is that the formula parameter takes in the expression of the non-linear model one wants to estimate (e.g. y ~ a / (b + c*x), where 'y' and 'x' are variables and 'a', 'b' and 'c' are the parameters of interest) and the start parameter takes in starting values of the parameters of interest, which R will use in the iteration process (because nonlinear least squares basically iterates calculations until the best values for the parameters are obtained).

Below are the steps:

(i) Obtain the starting values of the parameters 'a', 'b' and 'c'

Here, I used the lm() function to estimate the coefficient of equation (2). I started by creating lagged variables to use in the function.

NB: 'y' refers to 'pi'

y_1 = c(NA, head(y, head(y, -1) # variable 'y' lagged  by one time period
y_2 = c(c(NA, NA), head(y, head(y, -2) # variable 'y' lagged by two time periods
x_1 = c(NA, head(x, head(x, -1) # variable 'x' lagged by one time period

So, to estimate the coefficients of the equation, the following code was used:

reg = lm(y ~ y_1 + y_2 + x_1, na.action = na.exclude) # it is important to tell R to exclude the missing values (NA) that we included as we constructed the lagged variables

Now that we have estimates for coef1, coef2 and coef3, we can go ahead and calculate values for 'a', 'b' and 'c' in the following way:

B = 1 / reg$coefficients["y_1"] # Calculates the inverse of the coefficient on the variable 'y_1'

A = B * reg$coefficients["y_2"] # Multiplies 'b' by the coefficient on the variable 'y_2'

C = B * reg$coefficients["x_1"] # Multiplies 'b' by the coefficient on the variable 'x_1'

A, B and C are then used as the starting values in the nls() function

(ii) Use the nls() function

nlreg = nls(y ~ (1/b)*y_1 - (a/b)*y_2 - (c/b)*x_1,
        start = list(a = A, b = B, c = C))

The results can be seen with the code:

summary(nlreg)

Thanks to Ben Bolker for providing the insight :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top