sampling: Draw posterior samples from an RStanTVA model

samplingR Documentation

Draw posterior samples from an RStanTVA model

Description

Draw samples from the model defined by object.

Usage

sampling(object, ...)

## S4 method for signature 'stantvamodel'
sampling(
  object,
  data,
  init = "random",
  ...,
  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)
)

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.

backend

Which backend to use for fitting (default: rstan)

cpp_options

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

Value

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

Functions

  • sampling(stantvamodel): method


RStanTVA documentation built on April 16, 2025, 5:10 p.m.