I am absolutely amazed with fable "family" package, like fabletools and feasts.

My questions is about the possibility to introduce restriction on coefficients. So, suppose one want to estimate an augment forward looking phillips curve:

Inflation ~ beta_1 * inflation_lag1 + beta_2 * inflation_expectation + beta_3 * inflation_external + beta_4 * output_gap.

But one need to impose a vertical restriction on inflation coefficients, like:

beta_1 + beta_2 + beta_3 = 1

Is it possible to do with fable/feasts/fabletools? If not, any suggestion on how can one estimate such a model?

Suppose Y_t= `inflation`

, E_t= `inflation_expectation`

, X_t= `inflation_external`

and Z_t= `output_gap`

. Then you want to estimate

Y_t = \beta_1 Y_{t-1} + \beta_2 E_t + (1 − \beta_1 - \beta_2) X_t + \beta_4 Z_t + \varepsilon_t

We can rewrite this equation as follows:

Y_t - X_t = \beta_1 (Y_{t-1}-X_t) + \beta_2 (E_t -X_t) + \beta_4 Z_t + \varepsilon_t

Now we have an unconstrained regression where the response variable is Y_t-X_t and we regress against Y_{t-1}-X_t , E_t-X_t and Z_t .

```
library(tsibble)
library(fable)
set.seed(10)
df <- tsibble(
time = 1:10,
inflation = rnorm(10),
inflation_expectation = rnorm(10),
inflation_external = rnorm(10),
output_gap = rnorm(10),
index = time
)
fit <- df %>%
model(
constrained = TSLM(inflation - inflation_external ~ -1 +
I(lag(inflation) - inflation_external) +
I(inflation_expectation - inflation_external) +
output_gap),
)
report(fit)
#> Series: inflation - inflation_external
#> Model: TSLM
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -1.8388 -0.6701 -0.1745 0.1892 0.3676
#>
#> Coefficients:
#> Estimate Std. Error t value
#> I(lag(inflation) - inflation_external) 0.4103 0.3616 1.135
#> I(inflation_expectation - inflation_external) 0.2941 0.2393 1.229
#> output_gap -0.3676 0.3332 -1.103
#> Pr(>|t|)
#> I(lag(inflation) - inflation_external) 0.300
#> I(inflation_expectation - inflation_external) 0.265
#> output_gap 0.312
#>
#> Residual standard error: 0.8839 on 6 degrees of freedom
```

^{Created on 2020-05-17 by the reprex package (v0.3.0)}

The coefficients shown are estimates of \beta_1 , \beta_2 and \beta_4 . You can compute \beta_3 = 1-\beta_1-\beta_2 .

1 Like

system
Closed
June 5, 2020, 7:38pm
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.