Skip to content

Commit

Permalink
Issue #126: Import stats functions (#128)
Browse files Browse the repository at this point in the history
* Add importing stats functions

* Fix lint
  • Loading branch information
athowes authored Jun 23, 2024
1 parent b69a0b9 commit 08551cc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Imports:
posterior,
purrr,
ggridges,
here
here,
stats
Suggests:
bookdown,
epinowcast,
Expand Down
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,11 @@ import(cmdstanr)
import(data.table)
import(ggplot2)
importFrom(posterior,as_draws_df)
importFrom(stats,as.formula)
importFrom(stats,ecdf)
importFrom(stats,integrate)
importFrom(stats,median)
importFrom(stats,quantile)
importFrom(stats,rexp)
importFrom(stats,runif)
importFrom(stats,t.test)
1 change: 1 addition & 0 deletions R/fitting-and-postprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ make_relative_to_truth <- function(draws, secondary_dist, by = "parameter") {
#' @param not_by ...
#' @param by A vector of columns to group by
#' @family postprocess
#' @importFrom stats median quantile
#' @export
summarise_draws <- function(draws, sf, not_by = "value", by) {
if (missing(by)) {
Expand Down
1 change: 1 addition & 0 deletions R/latent_individual.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ epidist_prepare.epidist_latent_individual <- function(data, ...) {
#' @param ... ...
#' @method epidist_formula epidist_latent_individual
#' @family latent_individual
#' @importFrom stats as.formula
#' @export
epidist_formula.epidist_latent_individual <- function(data, delay_central = ~ 1,
sigma = ~ 1, ...) {
Expand Down
1 change: 1 addition & 0 deletions R/plot-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ calculate_cohort_mean <- function(data, type = c("cohort", "cumulative"),
#' @param ptime ...
#' @param distribution ...
#' @family plot
#' @importFrom stats integrate
#' @export
calculate_truncated_means <- function(draws, obs_at, ptime,
distribution = function(x, y, z) {
Expand Down
1 change: 1 addition & 0 deletions R/preprocess.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ combine_obs <- function(truncated_obs, obs) {
#' @param additional_by ...
#' @family preprocess
#' @autoglobal
#' @importFrom stats t.test
#' @export
calculate_censor_delay <- function(truncated_obs, additional_by = c()) {
truncated_obs_psumm <- data.table::copy(truncated_obs)
Expand Down
4 changes: 4 additions & 0 deletions R/simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' (primary event time).
#'
#' @family simulate
#' @importFrom stats runif
#' @export
simulate_uniform_cases <- function(sample_size = 1000, t = 60) {
data.table::data.table(
Expand All @@ -34,6 +35,7 @@ simulate_uniform_cases <- function(sample_size = 1000, t = 60) {
#' (primary event time).
#'
#' @family simulate
#' @importFrom stats runif
#' @export
simulate_exponential_cases <- function(r = 0.2,
sample_size = 10000,
Expand Down Expand Up @@ -74,6 +76,7 @@ simulate_exponential_cases <- function(r = 0.2,
#' (primary event time).
#'
#' @family simulate
#' @importFrom stats rexp
#' @export
simulate_gillespie <- function(r = 0.2,
gamma = 1 / 7,
Expand Down Expand Up @@ -166,6 +169,7 @@ simulate_secondary <- function(linelist, dist = rlnorm, ...) {
#' delays.
#'
#' @family simulate
#' @importFrom stats runif ecdf
#' @export
simulate_double_censored_pmf <- function(
alpha, beta, max, n = 1000,
Expand Down

0 comments on commit 08551cc

Please sign in to comment.