Learn R Programming

bivarhr (version 0.1.5)

.build_model_with_floor: Build CmdStan model with custom FLOOR constant

Description

Takes a Stan program as a single string and replaces the declaration of the scalar constant FLOOR with a user supplied numeric value, then compiles it as a CmdStanR model with threading enabled.

Usage

.build_model_with_floor(stan_code, floor_value)

Value

A CmdStanModel object (requires 'cmdstanr' package).

Arguments

stan_code

Character string containing the Stan program. It must include a line of the form real FLOOR = ...; that will be replaced.

floor_value

Numeric scalar used to set the constant FLOOR in the generated Stan code.

Details

The replacement is performed using a regular expression, so the Stan code must follow the pattern used in the bivariate hurdle model templates of this package. The compiled model has stan_threads turned on via cpp_options.