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")
- Changed URLs to DOIs.
- Fixed function links to other packages in documentation.
- Updated the Stan codes to accomodate the new array syntax. PR by Andrew Johnson.
- Fixed the initial values in the examples of walker in order to get sampler started.
- Fully delegated the installation to rstantools via PR by Andrew Johnson.
- Fixed the LFO computations in case the data contains missing values.
- Improved documentation of the gamma variables in
walker
,rw1
andrw2
.
- Added an example of counterfactual predictions to the vignette.
- Added citation info for the softwareX paper.
- Added a flag for stanc3 compatibility, thanks to Andrew Johnson. Also added an import for RcppParallel.
- Internal changes to make
walker
compatible with upcomingStanHeaders
.
- Changed the name of the
logLik
variable tolog_lik
so it is compatible withloo
.
- Fixed some issues in the vignette which resulted CRAN warnings.
- For linear-Gaussian models the stanfit object now returns partial log-likelihood terms
p(y_t | y_1,...,y_t-1,theta) which can be used for leave-future-out cross-validation (see function
lfo
). - New function
lfo
for estimating the leave-future-out information criterion. - Priors for the standard deviation parameters are now Gamma instead of truncated normal, which helps to avoid (rare) problems where sampler wonders close to degenerate case of having all variances near zero. There are also default prior Gamma(2, 0.0001) for these parameters now.
- Fixed some issues in the vignette added a reference to the walker paper.
- stanfit object of walker output now contains also variable
logLik
. For non-Gaussian models this is the approximate log-likelihood, the unbiased estimate is thenlogLik + mean(w)
, wherew
are the returned weights.
- Predict method now allow predictions on link scale.
- Added argument for plot_predict for controlling the drawing of past observations.
- Fix out-of-sample predictions for non-Gaussian models.
- New function:
predict_counterfactual
which can be used to predict the past assuming new values for the covariates.
- Proper export of
pp_check
forbayesplot
, fixed some minor technical issues.
- Added default values for
row.names
andoptional
foras.data.frame
function.
- Added as.data.frame function for
walker
andwalker_glm
output. - Added a
summary
method. - The print method now correctly warns about approximate results in case of non-Gaussian model.
- Changed arguments
*_prior
to more concise versions (e.g.sigma_prior
is now justsigma
). - Changed the name of the slope terms to
nu
as in vignette formulas. - Updated to rstantools 2.0.0 package structure and removed dependency on soft-depracated functions of
dplyr
.
- Removed check for missing values in function
walker
which threw an error even though missing values in responses have been in principle supported since 2018...
- Switched from GPL2+ to GPL3 in order to be compatible with future Stan versions.
- Added methods fitted and coef for extracting the posterior means and and regression coefficents from the walker_fit object.
- Fixed issue with Makevars and clang4 per request by CRAN.
- Added option to predict on mean-scale, e.g, probabilities instead of 0/1 in Bernoulli case.
- Fixed a bug in the Gaussian predictions, last time point was missing the observational level noise.
- Issue with upcoming staged installation in CRAN fixed by Tomas Kalibera.
- Dimension bug in GLM case fixed.
- Fixed StanHeaders search in Makevars.
- Pull request by Ben Goodrich for fixing the issue with clang4. New version on it's way to CRAN.
- Missing values in response variable are now supported.
- Added gamma variables to models which can be used to damp the variance of the random walks.
- Tidied some Stan codes in order to reduce deep copying.
- Moved stan codes under
src
. - Increased the iteration counts in examples in order to pass CRAN tests. <