|
40 | 40 | #'
|
41 | 41 | #' @return
|
42 | 42 | #' 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 |
44 | 44 | #' is at risk in both treatment group and control group.
|
45 | 45 | #' Other variables in this represent the following within each stratum at
|
46 | 46 | #' each time at which one or more events are observed:
|
|
62 | 62 | #' @export
|
63 | 63 | #'
|
64 | 64 | #' @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. |
71 | 74 | #'
|
72 | 75 | #' @examples
|
73 | 76 | #' # Example 1
|
@@ -152,7 +155,7 @@ counting_process <- function(x, arm) {
|
152 | 155 | if ("generate_by_simpwsurv" %in% names(attributes(x))) {
|
153 | 156 | ratio <- attributes(x)$ratio
|
154 | 157 | } else {
|
155 |
| - # if not, calcualte the emperical ratio |
| 158 | + # if not, calculate the empirical ratio |
156 | 159 | ratio <- sum(x$treatment == arm) / sum(x$treatment != arm)
|
157 | 160 | }
|
158 | 161 | attr(ans, "ratio") <- ratio
|
|
0 commit comments