Skip to content

Commit

Permalink
feat: Added an mcmcglm method for "coef" function
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiaslj committed Dec 8, 2024
1 parent ab415c5 commit 97431ba
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(coef,mcmcglm)
S3method(log_density,NegativeBinomial)
S3method(log_density,binomial)
S3method(log_density,gaussian)
Expand Down
9 changes: 9 additions & 0 deletions R/mcmcglm_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ samples.mcmcglm <- function(x) {
x$beta_samples
}

#' S3 method for getting the average value of coefficients
#'
#' @param x an `mcmcglm` object
#'
#' @export
coef.mcmcglm <- function(x) {
x$beta_mean
}

#' Create a trace plot of the MCMC samples
#'
#' @inheritParams samples
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ reference:
desc: >
Methods to explore results - data of samples and function for creating trace plot
contents:
- coef.mcmcglm
- samples
- trace_plot
- subtitle: Tuning parameters of slice sampling
Expand Down
14 changes: 14 additions & 0 deletions man/coef.mcmcglm.Rd

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

2 changes: 1 addition & 1 deletion vignettes/performance.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ withr::local_seed(42)
### Using default slice function
```{r run-compare-nvars}
res <- compare_eta_comptime_across_nvars(
n_vars = c(2, seq(from = 10, to = 60, by = 10)),
n_vars = c(2, seq(from = 500, to = 1000, by = 500)),
n_samples = 10,
burnin = 1,
w = 0.5,
Expand Down

0 comments on commit 97431ba

Please sign in to comment.