View source: R/extreme_case_control.R
draw_mecc | R Documentation |
Draw matched (more) extreme case-control samples
draw_mecc( cohort, tau0, tau, id_name, t_name, delta_name, match_var_names = NULL, n_per_case, mecc_names = c("y_mecc", "surv", "surv_tau", "set_id_mecc") )
cohort |
Cohort data. |
tau0 |
Only subjects who had event before |
tau |
Only subjects who did not have event at or before |
id_name |
Name of subject ID. |
t_name |
Name of time variable. |
delta_name |
Name of event/censoring indicator. |
match_var_names |
Name(s) of the match variable(s) in |
n_per_case |
Number of controls to match to each case. |
mecc_names |
Names to assign to the following four variables (in
sequence): the indicator for extreme events, the estimated survival
probability at each time point, the estimated survival probability at
|
This function draws a (more) extreme case-control sample from a
cohort, with or without matching on confounder(s), with n_per_case
controls drawn for each case. Eligible cases are subjects who had the event
before time tau0
(and all of them are sampled), and eligible
controls are subjects who do not have the event until time tau
. This
function throws an error if there is not enough controls to select from,
otherwise it uses the draw_mcc
function to draw a
case-control sample.
This package implements the conditional approach described in Section 2.2
of Salim et al 2014, where cases and controls are "individually matched".
Therefore, although controls are selected randomly or by frequency
matching, n_per_case
controls would be randomly assigned to a case
to form a "matched set" after drawing the sample.
Returns a data.frame
of the (more) extreme case-control
sample, with four additional columns as described in parameter
mecc_names
.
Yilin Ning, Nathalie C Støer
Salim A, Ma X, Fall K, et al. Analysis of incidence and prognosis from 'extreme' case–control designs. Stat Med 2014; 33: 5388–5398.
Støer NC, Salim A, Bokenberger K, et al. Is the matched extreme case–control design more powerful than the nested case–control design?. Stat Methods Med Res 2019; 28(6): 1911-1923.
llh_mecc_cond
, analyse_mecc_cond
library(SamplingDesignTools) # Load cohort data data("cohort_1") head(cohort_1) # Draw simple 1:2 more extreme case-control sample, matched on gender. # Let cases be subjects who had the event within 5 years, and controls be # selected from those who did not have the event until the 15-th year. dat_mecc <- draw_mecc(cohort = cohort_1, tau0 = 5, tau = 15, id_name = "id", t_name = "t", delta_name = "y", match_var_names = "gender", n_per_case = 2) head(dat_mecc) # Note that the new event indicator, `y_mecc`, is different from the original # event, `y`, in the cohort: identical(dat_mecc$y, dat_mecc$y_mecc) # Expect FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.