steve-the-bayesian / BOOM

A C++ library for Bayesian modeling, mainly through Markov chain Monte Carlo, but with a few other methods supported. BOOM = "Bayesian Object Oriented Modeling". It is also the sound your computer makes when it crashes.
GNU Lesser General Public License v2.1
35 stars 14 forks source link

Trig seasonality assumes only one seasonal component. #40

Closed steve-the-bayesian closed 4 years ago

steve-the-bayesian commented 5 years ago

Adding multiple cycles (via addTrig), but output only returns sd of one.

Reproducible (and artificial example): library(bsts) data(AirPassengers) y <- log(AirPassengers) ss <- AddLocalLinearTrend(list(), y) ss <- AddTrig(ss, y, period = 20, frequencies = 1) ss <- AddTrig(ss, y, period = 41, frequencies = 1)

model <- bsts(y, state.specification = ss, niter = 500)

only one available: model$trig.coefficient.sd

Thanks, Alexios

alexiosg commented 5 years ago

I checked and it does return the correct number of trig.coefficient.sd slots, but because they have the same name (unlike the seasonal component which is appended with its period e.g. sigma.seasonal.12) it is not immediately visible if trying to access it via named argument, but can be accessed by slot number. Suggestion: rename the trig.coefficient.sd to include some identifying information e.g. trig20.coefficient.sd.

steve-the-bayesian commented 5 years ago

Makes sense, and that works like the time domain seasonal models.

On Fri, Sep 6, 2019 at 12:05 PM alexiosg notifications@github.com wrote:

I checked the and it does return the correct number of number of trig.coefficient.sd, but because they have the same name (unlike the seasonal component which is appended with its period e.g. sigma.seasonal.12) and so is not immediately seen if trying to access it via a name, but can be access by its slot number. Suggestion, rename the trig.coefficient.sd to include some identifying information e.g. trig20.coefficient.sd.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/steve-the-bayesian/BOOM/issues/40?email_source=notifications&email_token=ABMVDVLIYMSYGNKVYIKDVFDQIKSX7A5CNFSM4IUDXGAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6DYZWA#issuecomment-528977112, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMVDVOGFK5WQAHJWKJFE73QIKSX7ANCNFSM4IUDXGAA .

steve-the-bayesian commented 4 years ago

Trig components now indexed by period.