R: Generic function for pointwise log-likelihood

log_lik {rstantools} | R Documentation

## Generic function for pointwise log-likelihood

### Description

We define a new function `log_lik` rather than a `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 `log_lik.stanreg` in the rstanarm package for an example.

### Usage

    log_lik(object, ...)

### Arguments

`object` | The object to use.
`...` | Arguments passed to methods. See the methods in the rstanarm package for examples.

### 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 for example methods (CRAN, GitHub).

- The guidelines for developers of R packages interfacing with Stan, a copy of which can be found in the package vignettes. See `browseVignettes("rstantools")` or `vignette(package = "rstantools")`. The document is also available online at the rstantools page on the CRAN website.

### Examples

    # See help("log_lik", package = "rstanarm")

[Package rstantools version 1.4.0 Index]