Skip to content

Commit

Permalink
Issue #320: Rename delay central (#325)
Browse files Browse the repository at this point in the history
* Rename delay_central as delay

* Run document
  • Loading branch information
athowes authored Sep 13, 2024
1 parent 687f597 commit 2d0b379
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ utils::globalVariables(c(
"stime_upr", # <as_latent_individual.data.frame>
"woverlap", # <as_latent_individual.data.frame>
"swindow", # <as_latent_individual.data.frame>
"delay_central", # <as_latent_individual.data.frame>
"delay", # <as_latent_individual.data.frame>
"row_id", # <as_latent_individual.data.frame>
"woverlap", # <epidist_stancode.epidist_latent_individual>
"row_id", # <epidist_stancode.epidist_latent_individual>
Expand Down
8 changes: 4 additions & 4 deletions R/latent_individual.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ as_latent_individual.data.frame <- function(data) {
)]
data[, woverlap := as.numeric(stime_lwr < ptime_upr)]
data[, swindow := stime_upr - stime_lwr]
data[, delay_central := stime_lwr - ptime_lwr]
data[, delay := stime_lwr - ptime_lwr]
data[, row_id := seq_len(.N)]
if (nrow(data) > 1) {
data <- data[, id := as.factor(id)]
Expand Down Expand Up @@ -86,7 +86,7 @@ epidist_validate.epidist_latent_individual <- function(data) {
must.include = c("case", "ptime_lwr", "ptime_upr",
"stime_lwr", "stime_upr", "obs_at",
"id", "obs_t", "pwindow", "woverlap",
"swindow", "delay_central", "row_id")
"swindow", "delay", "row_id")
)
if (nrow(data) > 1) {
checkmate::assert_factor(data$id)
Expand All @@ -95,7 +95,7 @@ epidist_validate.epidist_latent_individual <- function(data) {
checkmate::assert_numeric(data$pwindow, lower = 0)
checkmate::assert_numeric(data$woverlap, lower = 0)
checkmate::assert_numeric(data$swindow, lower = 0)
checkmate::assert_numeric(data$delay_central, lower = 0)
checkmate::assert_numeric(data$delay, lower = 0)
checkmate::assert_integer(data$row_id, lower = 0)
}

Expand Down Expand Up @@ -157,7 +157,7 @@ epidist_formula.epidist_latent_individual <- function(data, family, formula,
formula <- brms:::validate_formula(formula, data = data, family = family)

formula <- stats::update(
formula, delay_central | vreal(obs_t, pwindow, swindow) ~ .
formula, delay | vreal(obs_t, pwindow, swindow) ~ .
)

# Using this here for checking purposes
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-latent_individual.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ test_that("epidist_formula.epidist_latent_individual with default settings produ
expect_s3_class(form, "brmsformula")
expect_equal(
as_string_formula(form$formula),
"delay_central | vreal(obs_t, pwindow, swindow) ~ 1"
"delay | vreal(obs_t, pwindow, swindow) ~ 1"
)
expect_equal(
as_string_formula(form$pforms$sigma),
Expand All @@ -102,7 +102,7 @@ test_that("epidist_formula.epidist_latent_individual with custom formulas produc
expect_s3_class(form_sex, "brmsformula")
expect_equal(
as_string_formula(form_sex$formula),
"delay_central | vreal(obs_t, pwindow, swindow) ~ sex"
"delay | vreal(obs_t, pwindow, swindow) ~ sex"
)
expect_equal(
as_string_formula(form_sex$pforms$sigma),
Expand Down

0 comments on commit 2d0b379

Please sign in to comment.