View source: R/mrct_four_sets.R
| mrct_four_sets | R Documentation |
Fits the unadjusted two-sample Cox model on each set of the regional-consistency
analysis, from columns you name: all patients, the region, region(G^*) (the
region without the true harmed subgroup, when truth.name is given) and
region(\hat G) (the region without the subgroup \hat H). The sets and
their labels are those of mrct_case_study() and mrct_trial_analysis(), and
print() and plot() draw on the same code.
mrct_four_sets(
df,
outcome.name,
event.name,
treat.name,
region.name,
in_Hhat = NULL,
truth.name = NULL
)
## S3 method for class 'mrct_four_sets'
print(x, digits = 3, ...)
## S3 method for class 'mrct_four_sets'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'mrct_four_sets'
plot(
x,
which = c("forest", "km"),
xlim = c(0.3, 2),
time_unit = NULL,
analysis_time = NULL,
...
)
df |
A data frame with one row per patient. |
outcome.name, event.name, treat.name |
Columns: the time, the event indicator (1 = event) and the treatment (1 = experimental). |
region.name |
The region column (1 = in the region, 0 = not). |
in_Hhat |
Logical, one value per row: membership of |
truth.name |
Optional column of the true harmed subgroup (1 = in |
x |
An |
digits |
Digits for hazard ratios. Default 3. |
... |
Unused. |
row.names, optional |
Unused, as in |
which |
Any of |
xlim |
Hazard-ratio range of the forest plot. Default |
time_unit |
Character. The label of the Kaplan-Meier time axis; |
analysis_time |
The Kaplan-Meier axis's upper limit. |
An object of class mrct_four_sets, a list with
sets: the table, also returned by as.data.frame(): set, label, n,
n_exp, n_ctl, events_exp, events_ctl, and the Cox fit on the set: hr,
lo, hi (Wald 95%), se_loghr. The rows are itt_all, itt_region,
region_Gstar (with truth.name) and region_Ghat.
confusion: with truth.name, a list of two integer vectors
c(TP, FP, FN, TN) of \hat H against H^*, nonregion and region;
else NULL.
trial, in_Hhat, and call_args, the column names.
mrct_trial_analysis() for the whole pipeline on an observed trial;
mrct_case_study() for a simulated trial.
set.seed(1)
n <- 400
d <- data.frame(time = rexp(n, 0.1), event = rbinom(n, 1, 0.8),
treat = rbinom(n, 1, 0.5), region = rbinom(n, 1, 0.25),
x = rbinom(n, 1, 0.3))
fs4 <- mrct_four_sets(d, "time", "event", "treat", region.name = "region",
in_Hhat = d$x == 1)
fs4
as.data.frame(fs4)[, c("set", "n", "hr", "lo", "hi")]
plot(fs4, which = "forest")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.