Skip to content

Local level explanatory time varying#286

Open
PaulMainwood wants to merge 6 commits into
LAMPSPUC:masterfrom
PaulMainwood:LocalLevelExplanatoryTimeVarying
Open

Local level explanatory time varying#286
PaulMainwood wants to merge 6 commits into
LAMPSPUC:masterfrom
PaulMainwood:LocalLevelExplanatoryTimeVarying

Conversation

@PaulMainwood

Copy link
Copy Markdown

A new model - Local Level Explanatory allowing time varying regression coefficients.

Possible fix for issue #282 (though it is possible that you did not want a local level on that one - if not, could be addressed by setting sigma2_{\xi} = 0).

In Durbin/Koopmans' notation, the model is:

\begin{gather*}
    \begin{aligned}
        y_{t} &=  \mu_{t} + X_{1,t} \cdot \beta_{1,t} + \dots + X_{n,t} \cdot \beta_{n,t} + \varepsilon_{t} \quad &\varepsilon_{t} \sim \mathcal{N}(0, \sigma^2_{\varepsilon})\\
        \mu_{t+1} &= \mu_{t} + \xi_{t} &\xi_{t} \sim \mathcal{N}(0, \sigma^2_{\xi})\\
        \beta_{1,t+1} &= \beta_{1,t} + \tau_{1, t} &\tau_{1, t} \sim \mathcal{N}(0, \sigma^2_{\tau_{1}})\\
        \dots &= \dots\\
        \beta_{n,t+1} &= \beta_{n,t} + \tau_{n, t} &\tau_{n, t} \sim \mathcal{N}(0, \sigma^2_{\tau_{n}})\\\\
    \end{aligned}
\end{gather*}

The model automatically starts with all coefficients allowed to be time-varying. This can quickly lead to overfitting, so it is useful to fix one or more of the tau hyperparameters to zero to force those coefficients constant. With all taus set to zero, the model reduces to Local Level Explanatory.

(This is my first try at a pull request, so please do forgive lapses in etiquette / bad code / poor practices!)

@codecov

codecov Bot commented Jun 29, 2021

Copy link
Copy Markdown

Codecov Report

Merging #286 (9c00531) into master (b1723e7) will increase coverage by 0.11%.
The diff coverage is 100.00%.

❗ Current head 9c00531 differs from pull request most recent head 5acb6c5. Consider uploading reports for the commit 5acb6c5 to get more accurate results

@@            Coverage Diff             @@
##           master     #286      +/-   ##
==========================================
+ Coverage   93.88%   94.00%   +0.11%     
==========================================
  Files          33       34       +1     
  Lines        3043     3101      +58     
==========================================
+ Hits         2857     2915      +58     
  Misses        186      186              
Impacted Files Coverage Δ
src/fit.jl 97.40% <ø> (ø)
src/models/locallevelexplanatorytimevarying.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1723e7...5acb6c5. Read the comment docs.

@guilhermebodin

guilhermebodin commented Jun 29, 2021

Copy link
Copy Markdown
Member

Hi @PaulMainwood the PR looks good! Thank you for your contribution :) unfortunately you got an error on julia 1.0 ci.
Just a small request, if possible please bump the version on Project.toml from 0.5.17 to 0.5.18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants