Description Usage Arguments Value Examples

Constructs a basic structural model with local level or local trend component and seasonal component.

1 2 |

`y` |
Vector or a |

`sd_y` |
A fixed value or prior for the standard error of observation equation. See priors for details. |

`sd_level` |
A fixed value or a prior for the standard error of the noise in level equation. See priors for details. |

`sd_slope` |
A fixed value or a prior for the standard error of the noise in slope equation. See priors for details. If missing, the slope term is omitted from the model. |

`sd_seasonal` |
A fixed value or a prior for the standard error of the noise in seasonal equation. See priors for details. If missing, the seasonal component is omitted from the model. |

`beta` |
Prior for the regression coefficients. |

`xreg` |
Matrix containing covariates. |

`period` |
Length of the seasonal component i.e. the number of |

`a1` |
Prior means for the initial states (level, slope, seasonals). Defaults to vector of zeros. |

`P1` |
Prior covariance for the initial states (level, slope, seasonals). Default is diagonal matrix with 1000 on the diagonal. |

`obs_intercept, state_intercept` |
Intercept terms for observation and state equations, given as a length n vector and m times n matrix respectively. |

Object of class `bsm`

.

1 2 3 4 5 6 7 8 | ```
prior <- uniform(0.1 * sd(log10(UKgas)), 0, 1)
model <- bsm(log10(UKgas), sd_y = prior, sd_level = prior,
sd_slope = prior, sd_seasonal = prior)
mcmc_out <- run_mcmc(model, n_iter = 5000)
summary(expand_sample(mcmc_out, "theta"))$stat
mcmc_out$theta[which.max(mcmc_out$posterior), ]
sqrt((fit <- StructTS(log10(UKgas), type = "BSM"))$coef)[c(4, 1:3)]
``` |

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.