The $variables() method of a CmdStanModel object returns a list, each element representing a Stan model block: data, parameters, transformed_parameters and generated_quantities.

Each element contains a list of variables, with each variables represented as a list with infromation on its scalar type (real or int) and number of dimensions.

transformed data is not included, as variables in that block are not part of the model's input or output.

variables()

Value

The $variables() returns a list with information on input and output variables for each of the Stan model blocks.

Examples

# \dontrun{
file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan")

# create a `CmdStanModel` object, compiling the model is not required
mod <- cmdstan_model(file, compile = FALSE)

mod$variables()
#> $parameters
#> $parameters$theta
#> $parameters$theta$type
#> [1] "real"
#> 
#> $parameters$theta$dimensions
#> [1] 0
#> 
#> 
#> 
#> $included_files
#> list()
#> 
#> $data
#> $data$N
#> $data$N$type
#> [1] "int"
#> 
#> $data$N$dimensions
#> [1] 0
#> 
#> 
#> $data$y
#> $data$y$type
#> [1] "int"
#> 
#> $data$y$dimensions
#> [1] 1
#> 
#> 
#> 
#> $transformed_parameters
#> named list()
#> 
#> $generated_quantities
#> named list()
#> 

# }