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 functionality to create censored columns given truth #373

Open
athowes opened this issue Oct 10, 2024 · 0 comments
Open

Add functionality to create censored columns given truth #373

athowes opened this issue Oct 10, 2024 · 0 comments

Comments

@athowes
Copy link
Collaborator

athowes commented Oct 10, 2024

This is distinct from the "preprocessing" version (see #313). This is taken from work on PR #352 which is being scrapped. But this will be useful when we do the "simulation" side of things:

#' Add columns for interval censoring of primary and secondary events
#'
#' @param linelist ...
#' @param pwindow The primary censoring window.
#' @param swindow The secondary censoring window.
#' @family observe
#' @autoglobal
#' @export
f <- function(linelist, pwindow = 1, swindow = 1) {
  assert_numeric(pwindow, lower = 0)
  assert_numeric(swindow, lower = 0)
  
  linelist |>
    mutate(
      ptime_lwr = .floor_mult(.data$ptime, f = pwindow),
      ptime_upr = .data$ptime_lwr + pwindow,
      stime_lwr = .floor_mult(.data$stime, f = swindow),
      stime_upr = .data$stime_lwr + swindow,
      delay_lwr = pmax(0, .data$stime_lwr - .data$ptime_lwr - 1),
      delay_upr = .data$delay_lwr + pwindow + swindow
    )
}
@athowes athowes added the high label Oct 10, 2024
@athowes athowes added medium and removed high labels Nov 13, 2024
@seabbs seabbs removed the medium label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants