Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
Package: clonecensorweighting
Title: Infrastructure for Clone-Censor-Weighting Analyses
Version: 0.0.0.9000
Authors@R:
person("Sang Ho", "Park", email = "shstat1729@gmail.com", role = c("aut", "cre"))
Authors@R: c(
person("Sang Ho", "Park", email = "shstat1729@gmail.com", role = c("aut", "cre")),
person("Youngrok", "Lee", role = "aut")
)
Author: Sang Ho Park [aut, cre],
Youngrok Lee [aut]
Maintainer: Sang Ho Park <shstat1729@gmail.com>
Description: Provides a starter package for clone-censor-weighting workflows
used in target trial emulation. The package currently includes data
ingestion helpers, a minimal data cloning routine, and utilities for
Expand Down
7 changes: 5 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ export(clone_censor_weighting)
export(create_censoring_logics_A)
export(create_final_data)
export(create_policy_A)
export(create_timestamp_table)
export(emul_estimate)
export(emul_estimate_bootstrap)
export(estimate_censoring)
export(make_surv_response)
export(read_trial_data)
export(split_at_timestamp)
export(weight_cases)
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,.env)
49 changes: 49 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# clonecensorweighting 0.0.0.9000

## Refactoring

* Split the final censoring-probability training data workflow into focused
functions.
* Kept `create_final_data()` as the public interface for constructing long-form
clone data.
* Moved `create_timestamp_table()` and `split_at_timestamp()` to internal helper
status and removed them from the package exports.
* Removed duplicated reshape code and script-style execution leftovers from the
package R files.
* Added clone-list and clone-column validation helpers for clearer errors when
required variables are missing.
* Updated `create_final_data()` internals to use explicit character-vector
column selection and joins.
* Added `estimate_censoring()` as the public interface for Cox, pooled-logit,
and stabilized pooled-logit censoring probability estimation.
* Added `weight_cases()` as the public interface for unstabilized and stabilized
inverse probability of censoring weights.
* Added `emul_estimate()` as the public interface for Cox, logistic, and
Kaplan-Meier analyses of the emulated trial.
* Added `emul_estimate_bootstrap()` as the public interface for bootstrap
confidence intervals for two-arm Cox and logistic analyses.
* Kept formula construction, cumulative uncensoring, baseline predictor
extraction, predictor/weight normalization, arm binding, and coefficient
extraction as internal helpers.

## Documentation

* Removed generated help pages for internal timestamp and splitting helpers.
* Regenerated the `create_final_data()` help source reference after moving the
function to its own file.
* Added generated help pages for censoring estimation, case weighting,
emulated-trial estimation, and bootstrap estimation.
* Added runnable examples for public workflow functions using the bundled
`lungcancer` data where appropriate.
* Updated the README with a full `lungcancer` clone-censor-weighting workflow.

## Testing

* Added focused tests for timestamp table creation, interval splitting, final
data construction, internal helper export status, and missing-column errors.
* Added focused tests for censoring probability estimation, IPC weighting,
emulated-trial model fitting, bootstrap output, and internal helper export
status.
* Added an integration test that runs the bundled `lungcancer` data through
cloning, censoring, interval expansion, censoring probability estimation,
weighting, emulated-trial estimation, and bootstrap estimation.
35 changes: 35 additions & 0 deletions R/apply_logics.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
#'
#' @export
#' @examples
#' data(lungcancer)
#' arms <- c("Control", "Surgery")
#' clones <- clone_arms(lungcancer, arms)
#' policies <- create_policy_A(
#' arms,
#' treatment = "surgery",
#' time_to_treatment = "timetosurgery",
#' grace_period = 182.62,
#' outcome = "death",
#' followup = "fup_obs",
#' clone_outcome = "outcome",
#' clone_followup = "fup"
#' )
#' clones_policy <- apply_logics(clones, policies)
apply_logics <- function(
clones,
logics
Expand Down Expand Up @@ -91,6 +105,17 @@ apply_logics <- function(
#'
#' @export
#' @examples
#' arms <- c("Control", "Surgery")
#' policies <- create_policy_A(
#' arms,
#' treatment = "surgery",
#' time_to_treatment = "timetosurgery",
#' grace_period = 182.62,
#' outcome = "death",
#' followup = "fup_obs",
#' clone_outcome = "outcome",
#' clone_followup = "fup"
#' )
create_policy_A <- function(
arms,
treatment,
Expand Down Expand Up @@ -203,6 +228,16 @@ create_policy_A <- function(
#'
#' @export
#' @examples
#' arms <- c("Control", "Surgery")
#' censoring_logics <- create_censoring_logics_A(
#' arms,
#' treatment = "surgery",
#' time_to_treatment = "timetosurgery",
#' grace_period = 182.62,
#' followup = "fup_obs",
#' clone_censoring = "censoring",
#' clone_uncensored_followup = "fup_uncensored"
#' )
create_censoring_logics_A <- function(
arms,
treatment,
Expand Down
Loading
Loading