the reason this happens is the intersection of the following:
-
underlyingly, both data inits and parameter inits are
stan::io::varcontext
objects. -
inits files can contain variables that aren’t in the model.
we need this because a part of the workflow is model expansion and model comparison, and it’s convenient to let all versions of a model run off the same data and inits files. -
unlike the data init file, which must contain definitions for all variables in the data block, the params init file doesn’t have to, therefore no complaints from CmdStan about missing parameter inits, similarly, no complaints about parameter inits for variable names that don’t match variables in the model.
further thoughts: missing functionality - the interfaces don’t have an operation to instantiate the model given the data and then initialize the parameters given the constraints and any supplied inits.
such an operation would detect missing data from the inits file. it could also report on the initial parameter values. thus one could easily validate the inits. but AFAIK, in C++ the resulting instantiated object can’t be saved such that you could just start adaptation and sampling from that point, so we don’t do this.