The R package walker provides a method for fully Bayesian generalized linear regression where the regression coefficients are allowed to vary over time as a first or second order integrated random walk.
The Markov chain Monte Carlo (MCMC) algorithm uses Hamiltonian Monte Carlo provided by Stan, using a state space representation of the model in order to marginalise over the coefficients for accurate and efficient sampling. For non-Gaussian models the MCMC targets approximate marginal posterior based on Gaussian approximation, which is then corrected using importance sampling as in Vihola, Helske, Franks (2020).
See the corresponding paper in softwareX for short introduction, and the package vignette and documentation manual for details and further examples.
You can download the development version of walker
from Github using the devtools
package:
devtools::install_github("helske/walker")
walker
, rw1
and rw2
.walker
compatible with upcoming StanHeaders
.logLik
variable to log_lik
so it is compatible with loo
.lfo
). lfo
for estimating the leave-future-out information criterion.logLik
.
For non-Gaussian models this is the approximate log-likelihood, the
unbiased estimate is then logLik + mean(w)
, where w
are the returned weights.predict_counterfactual
which can be used to predict the past assuming new
values for the covariates.pp_check
for bayesplot
, fixed some minor technical issues.row.names
and optional
for as.data.frame
function.walker
and walker_glm
output.summary
method.*_prior
to more concise versions (e.g. sigma_prior
is now just sigma
). nu
as in vignette formulas. dplyr
.walker
which threw an error even though missing values in responses have been in principle supported since 2018...src
.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.