Compute state dimensions

Description Author(s) References See Also Examples

Add a state component to the `state.specification`

argument in a
`bsts`

model.

Steven L. Scott stevescott@google.com

Harvey (1990), "Forecasting, structural time series, and the Kalman filter", Cambridge University Press.

Durbin and Koopman (2001), "Time series analysis by state space methods", Oxford University Press.

`bsts`

.
`SdPrior`

`NormalPrior`

`Ar1CoefficientPrior`

1 2 3 4 5 6 7 | ```
data(AirPassengers)
y <- log(AirPassengers)
ss <- AddLocalLinearTrend(list(), y)
ss <- AddSeasonal(ss, y, nseasons = 12)
model <- bsts(y, state.specification = ss, niter = 500)
pred <- predict(model, horizon = 12, burn = 100)
plot(pred)
``` |

```
Loading required package: BoomSpikeSlab
Loading required package: Boom
Loading required package: MASS
Attaching package: 'Boom'
The following object is masked from 'package:stats':
rWishart
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: xts
=-=-=-=-= Iteration 0 Fri Jun 9 19:14:26 2017 =-=-=-=-=
=-=-=-=-= Iteration 50 Fri Jun 9 19:14:26 2017 =-=-=-=-=
=-=-=-=-= Iteration 100 Fri Jun 9 19:14:26 2017 =-=-=-=-=
=-=-=-=-= Iteration 150 Fri Jun 9 19:14:26 2017 =-=-=-=-=
=-=-=-=-= Iteration 200 Fri Jun 9 19:14:26 2017 =-=-=-=-=
=-=-=-=-= Iteration 250 Fri Jun 9 19:14:26 2017 =-=-=-=-=
=-=-=-=-= Iteration 300 Fri Jun 9 19:14:27 2017 =-=-=-=-=
=-=-=-=-= Iteration 350 Fri Jun 9 19:14:27 2017 =-=-=-=-=
=-=-=-=-= Iteration 400 Fri Jun 9 19:14:27 2017 =-=-=-=-=
=-=-=-=-= Iteration 450 Fri Jun 9 19:14:27 2017 =-=-=-=-=
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.