Skip to content

Commit 52aa6be

Browse files
committed
Document attribute "ratio" returned by counting_process()
1 parent 85cdc8f commit 52aa6be

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

R/counting_process.R

+11-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#'
4141
#' @return
4242
#' A data frame grouped by `stratum` and sorted within stratum by `tte`.
43-
#' Remain rows with at least one event in the population, at least one subject
43+
#' It only includes rows with at least one event in the population, at least one subject
4444
#' is at risk in both treatment group and control group.
4545
#' Other variables in this represent the following within each stratum at
4646
#' each time at which one or more events are observed:
@@ -62,12 +62,15 @@
6262
#' @export
6363
#'
6464
#' @details
65-
#' The output produced by [counting_process()] produces a
66-
#' counting process dataset grouped by stratum and sorted within stratum
67-
#' by increasing times where events occur. The object is assigned the class
68-
#' "counting_process". It also has the attributes "n_ctrl" and "n_exp",
69-
#' which are the totals of the control and experimental treatments,
70-
#' respectively, from the input time-to-event data.
65+
#' The output produced by [counting_process()] produces a counting process
66+
#' dataset grouped by stratum and sorted within stratum by increasing times
67+
#' where events occur. The object is assigned the class "counting_process". It
68+
#' also has the attribute "ratio", which is the ratio of the events in the
69+
#' treatment arm compared to the control arm in the input time-to-event data. If
70+
#' the input data was generated by [sim_pw_surv()], the ratio attribute is
71+
#' simply obtained from the attribute of the same name from the input object.
72+
#' Otherwise, the returned ratio is the empirical ratio of treatment to control
73+
#' events.
7174
#'
7275
#' @examples
7376
#' # Example 1
@@ -152,7 +155,7 @@ counting_process <- function(x, arm) {
152155
if ("generate_by_simpwsurv" %in% names(attributes(x))) {
153156
ratio <- attributes(x)$ratio
154157
} else {
155-
# if not, calcualte the emperical ratio
158+
# if not, calculate the empirical ratio
156159
ratio <- sum(x$treatment == arm) / sum(x$treatment != arm)
157160
}
158161
attr(ans, "ratio") <- ratio

man/counting_process.Rd

+10-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)