Package 'atsar'

Title: Stan Routines For Univariate And Multivariate Time Series
Description: Bundles univariate and multivariate STAN scripts for FISH 507 class.
Authors: Eric J. Ward [aut, cre], Mark D. Scheuerell [aut], Elizabeth E. Holmes [aut], Kiva L. Oken [aut], Trustees of Columbia University [cph]
Maintainer: Eric J. Ward <[email protected]>
License: GPL (>=3)
Version: 0.1.6
Built: 2024-10-09 05:57:05 UTC
Source: https://github.com/atsa-es/atsar

Help Index


The 'atsar' package.

Description

A DESCRIPTION OF THE PACKAGE

References

Stan Development Team (2020). RStan: the R interface to Stan. R package version 2.21.2. https://mc-stan.org


fit_stan is the primary function which calls pre-written stan scripts for time series data.

Description

fit_stan is the primary function which calls pre-written stan scripts for time series data.

Usage

fit_stan(
  y,
  x = NA,
  model_name = NA,
  est_drift = FALSE,
  est_mean = FALSE,
  P = 1,
  Q = 1,
  mcmc_list = list(n_mcmc = 1000, n_burn = 500, n_chain = 3, n_thin = 1),
  family = "gaussian",
  est_nu = FALSE,
  marss = list(states = NULL, obsVariances = NULL, proVariances = NULL, trends = NULL),
  map_estimation = FALSE,
  hessian = FALSE,
  ...
)

Arguments

y

The response variable (numeric)

x

The predictors, either a vector or matrix

model_name

The specific name of the model to be fitted. Currently supported are 'regression', 'ar', 'rw', 'ma', 'ss_ar' (state space univariate AR), or 'ss_rw' (state space univariate random walk).

est_drift

Whether or not to estimate a drift parameter (default = FALSE). Only applicable to the rw and ar models.

est_mean

Whether to estimate a mean or not (for state space autoregressive model only)

P

The order of the ar model, with minimum value = 1 (default).

Q

The order of the ma model, with minimum value = 1 (default).

mcmc_list

A list of MCMC control parameters. These include the number of 'iterations' (default = 1000), burn in or warmup (default = 500), chains (default = 3), and thinning (default = 1)

family

A named distribution for the observation model, defaults to gaussian

est_nu

Boolean, whether to model process deviations as Student-t or not (default).

marss

A named list containing the following elements for specifying marss models: (states=NULL, obsVariances=NULL, proVariances=NULL, trends=NULL

map_estimation

Whether to do maximum a posteriori estimation via [rstan::optimizing()] (defualts to FALSE)

hessian

Whether to return hessian if map_estimation is TRUE via [rstan::optimizing()]

...

Any other arguments passed to [rstan::sampling()].

Value

an object of class 'rstan'