Learn R Programming

RStanTVA (version 0.3.2)

sampling: Draw posterior samples from an RStanTVA model

Description

Draw samples from the model defined by object.

Usage

sampling(object, ...)

# S4 method for stantvamodel sampling( object, data, init = "random", seed = sample.int(.Machine$integer.max, 1), ..., backend = c("rstan", "cmdstanr", "cmdstanr_mpi"), cpp_options = if (match.arg(backend) == "cmdstanr") list(stan_threads = object@code@config$parallel) else if (match.arg(backend) == "cmdstanr_mpi") list(CXX = "mpicxx", TBB_CXX_TYPE = "gcc", STAN_MPI = TRUE) )

Value

Returns a stantva_fit object, which inherits from stanfit, representing the fit of object to data.

Arguments

object

The StanTVA model object.

...

Further arguments passed to the sampling handler of the specified backend.

data

The data to which the model should be fitted, usually a data.frame.

init

How to initialize the individual chains, see rstan::sampling(). Note that for random, any lower-level hierarchical (e.g., subject-level) parameters are initialized to zero.

seed

Seed for random number generation and chain initialization

backend

Which backend to use for fitting (default: rstan)

cpp_options

Which options to pass to stan_model() for compiling the C++ code.

Functions

  • sampling(stantvamodel): method