View source: R/km_type_weights.R
compute_km_weights_controls | R Documentation |
Compute Kaplan-Meier type weights for newly collected NCC controls
compute_km_weights_controls( ncc_controls, risk_table_manual, t_start_name = NULL, t_name, match_var_names = NULL, n_per_case, km_names = c("km_prob", "km_weight") )
ncc_controls |
Newly collected NCC controls, where each row corresponds
to a unique subject. Make sure this dataset does not include any subject
that later became cases. This data should include the actual
event/censoring time of each subject. A |
risk_table_manual |
Number of subjects at risk at time of each cases in
the NCC, prepared using function |
t_start_name |
Name of the variable in |
t_name |
Name of the variable in |
match_var_names |
Name(s) of the match variable(s) in
|
n_per_case |
Number of controls matched to each case. |
km_names |
Column names for the KM-type probability (the first element)
and weight (the second element) computed. Default is
|
match_risk_table
, compute_km_weights
library(SamplingDesignTools) # Load mini cohort data("mini_cohort") mini_cohort # For illustrative purpose, assume subjects 5, 7 and 10 are newly collected # controls, so that the resulting Kaplan-Meier type weights are identical to # examples for compute_km_weights(): ncc_controls <- mini_cohort[c(5, 7, 10), c("id", "t")] ncc_controls # To use these newly sampled controls with existing cases, we need to have the # number of subjects at risk at event times in mini_cohort: risk_table <- compute_risk_table(cohort = mini_cohort, t_name = "t", y_name = "status") # The following command computes the Kaplan-Meier type weights for the newly # sampled controls: ncc_controls <- compute_km_weights_controls( ncc_controls = ncc_controls, risk_table_manual = risk_table, t_name = "t", n_per_case = 1 ) ncc_controls
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.