Skip to content

Commit

Permalink
Call to document
Browse files Browse the repository at this point in the history
  • Loading branch information
athowes committed Jul 22, 2024
1 parent fdd5305 commit 705cdc5
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 10 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Generated by roxygen2: do not edit by hand

S3method(add_natural_scale_mean_sd,default)
S3method(add_natural_scale_mean_sd,latent_gamma)
S3method(add_natural_scale_mean_sd,latent_lognormal)
S3method(as_latent_individual,data.frame)
S3method(epidist,default)
S3method(epidist_family,default)
Expand Down
10 changes: 7 additions & 3 deletions R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ utils::globalVariables(c(
"max_treedepth", # <epidist_diagnostics>
"per_at_max_treedepth", # <epidist_diagnostics>
"samples", # <epidist_diagnostics>
"meanlog", # <add_natural_scale_mean_sd>
"sdlog", # <add_natural_scale_mean_sd>
"sd", # <add_natural_scale_mean_sd>
"sdlog", # <extract_lognormal_draws>
"sdlog_log", # <extract_lognormal_draws>
"meanlog", # <extract_lognormal_draws>
Expand Down Expand Up @@ -72,6 +69,13 @@ utils::globalVariables(c(
"ptime_daily", # <plot_mean_posterior_pred>
"n", # <plot_mean_posterior_pred>
"obs_horizon", # <plot_mean_posterior_pred>
"mu", # <add_natural_scale_mean_sd.latent_lognormal>
"sigma", # <add_natural_scale_mean_sd.latent_lognormal>
"sd", # <add_natural_scale_mean_sd.latent_lognormal>
"sigma", # <add_natural_scale_mean_sd.latent_gamma>
"sd", # <add_natural_scale_mean_sd.latent_gamma>
"mu", # <add_natural_scale_mean_sd.latent_gamma>
"shape", # <add_natural_scale_mean_sd.latent_gamma>
"time", # <linelist_to_counts>
"primary", # <linelist_to_cases>
"secondary", # <linelist_to_cases>
Expand Down
3 changes: 3 additions & 0 deletions R/postprocess.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_natural_scale_mean_sd <- function(data, ...) {
#' @inheritParams add_natural_scale_mean_sd
#' @param ... Additional arguments for method.
#' @family postprocess
#' @method add_natural_scale_mean_sd default
#' @export
add_natural_scale_mean_sd.default <- function(data, ...) {
cli::cli_inform(
Expand All @@ -31,6 +32,7 @@ add_natural_scale_mean_sd.default <- function(data, ...) {
#' @inheritParams add_natural_scale_mean_sd
#' @param ... Additional arguments for method.
#' @family postprocess
#' @method add_natural_scale_mean_sd latent_lognormal
#' @autoglobal
#' @export
add_natural_scale_mean_sd.latent_lognormal <- function(data, ...) {
Expand All @@ -47,6 +49,7 @@ add_natural_scale_mean_sd.latent_lognormal <- function(data, ...) {
#' @inheritParams add_natural_scale_mean_sd
#' @param ... Additional arguments for method.
#' @family postprocess
#' @method add_natural_scale_mean_sd latent_gamma
#' @autoglobal
#' @export
add_natural_scale_mean_sd.latent_gamma <- function(data, ...) {
Expand Down
15 changes: 10 additions & 5 deletions man/add_natural_scale_mean_sd.Rd

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

28 changes: 28 additions & 0 deletions man/add_natural_scale_mean_sd.default.Rd

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

28 changes: 28 additions & 0 deletions man/add_natural_scale_mean_sd.latent_gamma.Rd

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

29 changes: 29 additions & 0 deletions man/add_natural_scale_mean_sd.latent_lognormal.Rd

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

3 changes: 3 additions & 0 deletions man/draws_to_long.Rd

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

3 changes: 3 additions & 0 deletions man/extract_lognormal_draws.Rd

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

3 changes: 3 additions & 0 deletions man/make_relative_to_truth.Rd

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

3 changes: 3 additions & 0 deletions man/summarise_draws.Rd

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

3 changes: 3 additions & 0 deletions man/summarise_variable.Rd

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

6 changes: 4 additions & 2 deletions tests/testthat/test-unit-postprocess.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ brms::posterior_predict(fit)
linpred_mu <- brms::posterior_linpred(fit, transform = TRUE, dpar = "mu")
linpred_sigma <- brms::posterior_linpred(fit, transform = TRUE, dpar = "sigma")

linpred_mu_melt <- reshape2::melt(linpred_mu, varnames = c("aaa", "bbb"), value.name = "mu")
linpred_sigma_melt <- reshape2::melt(linpred_sigma, varnames = c("aaa", "bbb"), value.name = "sigma")
linpred_mu_melt <- reshape2::melt(linpred_mu, varnames = c("draw", "index"), value.name = "mu")

Check warning on line 19 in tests/testthat/test-unit-postprocess.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-unit-postprocess.R,line=19,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 95 characters.
linpred_sigma_melt <- reshape2::melt(linpred_sigma, varnames = c("draw", "index"), value.name = "sigma")

Check warning on line 20 in tests/testthat/test-unit-postprocess.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-unit-postprocess.R,line=20,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 104 characters.

linpred_melt <- dplyr::left_join(linpred_mu_melt, linpred_sigma_melt)
class(linpred_melt) <- c(class(linpred_melt), "latent_lognormal")
add_natural_scale_mean_sd(data.table::as.data.table(linpred_melt))

pp <- brms::prepare_predictions(fit)
pp$dpars$mu$fe$b
Expand Down

0 comments on commit 705cdc5

Please sign in to comment.