resolve_x() and resolve_x_iid() are both thin wrappers around this: an
NPE fit maps one observation to one posterior, so resolve_x() calls this
with first_row = TRUE and keeps only row 1; an NLE fit's log-likelihood
sums over rows as independent observations of the same parameter, so
resolve_x_iid() calls this with first_row = FALSE and keeps every row.
The same x_obs therefore means "the first observation" to npe() and
"200 observations" to nle(), and a user moving a working call from one to
the other would otherwise get a posterior conditioned on a single data
point with nothing said about it. Truncating to row 1 warns rather than
fails: taking row 1 of a simulation matrix is a reasonable thing to ask
for.
Arguments
- post
An
nsbi_posteriorobject.- x
Observation to condition on, or
NULLto use the posterior'sx_obs.- first_row
TRUEto keep row 1 only, with a warning when there was more than one row (theresolve_x()behavior);FALSEto keep every row (theresolve_x_iid()behavior).- arg
Name the caller's argument goes by, for
check_numeric()'s andcheck_finite()'s error messages. Defaults to"x"whenfirst_rowand"obs"otherwise, matchingsample()'s andlog_prob()'s parameter names; the "no observation supplied" message is fixed to the same names and does not vary witharg.
Details
A non-finite entry is a different matter and stops here regardless of
first_row. An NA passes through apply_standardizer() into
de_sample() (NPE) or into mcmc_init() (NLE) and comes back as
unusable output with nothing to say about the observation – for NPE the
complaint lands in stats::quantile() inside summary(), for NLE in
mcmc_init() complaining about initialization. There is nothing sensible
to condition on either way, so this errors rather than warns.
