For models fit using MCMC only, the `log_lik`

method returns the
\(S\) by \(N\) pointwise log-likelihood matrix, where \(S\) is the size
of the posterior sample and \(N\) is the number of data points, or in the
case of the `stanmvreg`

method (when called on `stan_jm`

model objects) an \(S\) by \(Npat\) matrix where \(Npat\) is the number
of individuals.

# S3 method for stanreg
log_lik(object, newdata = NULL, offset = NULL, ...)
# S3 method for stanmvreg
log_lik(object, m = 1, newdata = NULL, ...)
# S3 method for stanjm
log_lik(object, newdataLong = NULL, newdataEvent = NULL, ...)

## Arguments

object |
A fitted model object returned by one of the
rstanarm modeling functions. See `stanreg-objects` . |

newdata |
An optional data frame of new data (e.g. holdout data) to use
when evaluating the log-likelihood. See the description of `newdata`
for `posterior_predict` . |

offset |
A vector of offsets. Only required if `newdata` is
specified and an `offset` was specified when fitting the model. |

... |
Currently ignored. |

m |
Integer specifying the number or name of the submodel |

newdataLong, newdataEvent |
Optional data frames containing new data
(e.g. holdout data) to use when evaluating the log-likelihood for a
model estimated using `stan_jm` . If the fitted model
was a multivariate joint model (i.e. more than one longitudinal outcome),
then `newdataLong` is allowed to be a list of data frames. If supplying
new data, then `newdataEvent` should also include variables corresponding
to the event time and event indicator as these are required for evaluating the
log likelihood for the event submodel. For more details, see the description
of `newdataLong` and `newdataEvent` for `posterior_survfit` . |

## Value

For the `stanreg`

and `stanmvreg`

methods an \(S\) by
\(N\) matrix, where \(S\) is the size of the posterior sample and
\(N\) is the number of data points. For the `stanjm`

method
an \(S\) by \(Npat\) matrix where \(Npat\) is the number of individuals.

## Examples

#> [1] 1000 262

#> [1] TRUE

#> 1 2
#> [1,] -7.183851 -3.419396
#> [2,] -6.728552 -3.369339
#> [3,] -6.913875 -3.497883
#> [4,] -6.433703 -3.516367
#> [5,] -7.500837 -3.342995
#> [6,] -7.810188 -4.052911

#> [1] 1000 2

#> [1] TRUE

# }