Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'nsamples' generic #35

Merged
merged 1 commit into from May 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -13,6 +13,7 @@ export(loo_linpred)
export(loo_pit)
export(loo_predict)
export(loo_predictive_interval)
export(nsamples)
export(posterior_interval)
export(posterior_linpred)
export(posterior_predict)
Expand Down
21 changes: 21 additions & 0 deletions R/nsamples.R
@@ -0,0 +1,21 @@
#' Generic function for extracting the number of posterior samples
#'
#' Extract the number of posterior samples stored in a fitted Bayesian model.
#'
#' @export
#' @template args-object
#' @template args-dots
#'
#' @examples
#' # Example using rstanarm package:
#' # nsamples method for 'stanreg' objects
#' \donttest{
#' if (require("rstanarm")) {
#' fit <- stan_glm(mpg ~ wt + am, data = mtcars)
#' nsamples(fit)
#' }
#' }
#'
nsamples <- function(object, ...) {
UseMethod("nsamples")
}
28 changes: 28 additions & 0 deletions man/nsamples.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.