Skip to content

A first Stan program needs fixed_param=True #6

@seanricardoford

Description

@seanricardoford

The first example model, binomial-rng.stan, does not use any parameters and only has a generated_quantities block (in addition to data). Therefore, per the CmdStan manual Algorithm section, the fixed_param option needs to be set. In CmdStanPy this is done with fixed_param = True.

The quarto cell starting at line 510 should become:

N = 100
theta = 0.3
data = {'N': N, 'theta': theta}
model = csp.CmdStanModel(stan_file = '../stan/binomial-rng.stan')
sample = model.sample(data = data, seed = 123, chains = 1,
                      iter_sampling = 10, fixed_param = True,
                      show_progress = False, show_console = False)

And the following arguments section should remove the inter_warmup description and could say something like:

  • fixed_param: when a model does not specify any parameters, as is the case here, this mush be True,

Importantly, let me add that this tutorial is wonderful. Thank you for taking the time to write it with CmdStanPy and Quarto.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions