get_model: Generate model code for passage to stan

Description Usage Arguments Details Value See Also

View source: R/get_model.r

Description

Generates a text string of code describing the model of interest for passage to the stan function in the rstan package. This function is called internally in the spmrf function.

Usage

1
2
get_model(prior = "horseshoe", likelihood = "normal", order = 1,
  zeta = 0.01, save.loglik = FALSE)

Arguments

prior

A character string specifying which prior to use on order-k differences. Choices are "horseshoe", "laplace", and "normal". Note that "laplace" priors are currently not available for coalescent likelihoods.

likelihood

A character string specifying the probability distribution of the observation variable. Current choices are "normal", "poisson", "binomial", and "coalescent".

order

Numeric value specifying order of differencing (1, 2, or 3). Note that order 3 is currently not available for coalescent likelihoods.

zeta

The hyperparameter for the global smoothing parameter gamma. This is the scale parameter of a half-Cauchy distribution. Smaller values will result in more smoothing depending on the prior specification and the strength of the data. Values must be > 0.

save.loglik

Logical flag for whether to calculate the individual components of the log-likelihood for use in calculating WAIC or LOOIC with the loo package. Default is FALSE.

Details

This function can be used to generate a text string containing code in the stan model syntax. This function is called by the spmrf function internally, so it is not necessary to use get_model external to spmrf.

Value

A character string of code describing the model of interest for passage to the function stan in the rstan package.

See Also

spmrf, stan, get_init


faulknerjam/bnps documentation built on Sept. 26, 2020, 8:07 p.m.