The $check_syntax() method returns TRUE (invisibly) if the model is valid. ## See also The CmdStanR website (mc-stan.org/cmdstanr) for online documentation and tutorials. The Stan and CmdStan documentation: Other CmdStanModel methods: model-method-compile, model-method-generate-quantities, model-method-optimize, model-method-sample_mpi, model-method-sample, model-method-variational ## Examples # \dontrun{ file <- write_stan_file(" data { int N; int y[N]; } parameters { // should have <lower=0> but omitting to demonstrate pedantic mode real lambda; } model { y ~ poisson(lambda); } ") mod <- cmdstan_model(file, compile = FALSE) # the program is syntactically correct, however... mod$check_syntax()#> Stan program is syntactically correct
# pedantic mode will warn that lambda should be constrained to be positive
# and that lambda has no prior distribution
mod\$check_syntax(pedantic = TRUE)#> Warning:#>   The parameter lambda has no priors.#> Warning at '/var/folders/h6/14xy_35x4wd2tz542dn0qhtc0000gn/T/RtmpGraDrG/file2ed27f29a77b.stan', line 11, column 14 to column 20:#>   A poisson distribution is given parameter lambda as a rate parameter#>   (argument 1), but lambda was not constrained to be strictly positive.#> Stan program is syntactically correct# }