We define a new function log_lik() rather than a
stats::logLik() method because (in addition to the conceptual
difference) the documentation for logLik() states that the return value
will be a single number, whereas log_lik() returns a matrix. See
the log_lik.stanreg()
method in the rstanarm package for an example of defining a method.
Value
log_lik() methods should return a \(S\) by \(N\) matrix,
where \(S\) is the size of the posterior sample (the number of draws from
the posterior distribution) and \(N\) is the number of data points.
See also
The rstanarm package (mc-stan.org/rstanarm) for example methods (CRAN, GitHub).
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.