Generic function and default method for computing predictive errors y - yrep (in-sample, for observed y) or y - ytilde (out-of-sample, for new or held-out y). See predictive_error.stanreg() in the rstanarm package for an example.
1 2 3 4
The object to use.
Arguments passed to methods. See the methods in the rstanarm package for examples.
For the default method, a vector of
predictive_error() methods should return a D by N
matrix, where D is the number of draws from the posterior predictive
distribution and N is the number of data points being predicted per
The default method just takes
object to be a matrix and
y to be a
Guidelines and recommendations for developers of R packages interfacing with Stan and a demonstration getting a simple package working can be found in the vignettes included with rstantools and at mc-stan.org/rstantools/articles.
1 2 3 4 5 6 7 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.