View source: R/km_type_weights.R
compute_risk_table | R Documentation |
Compute number at risk at each event time from a "skeleton cohort"
compute_risk_table( cohort, t_start_name = NULL, t_name, y_name, match_var_names = NULL )
cohort |
Cohort data with at least the following information on each
subject: start time (if not 0 for all subjects) and end time of follow-up,
censoring status and matching variables (if any). A |
t_start_name |
Name of the variable in |
t_name |
Name of the variable in |
y_name |
Name of the column of censoring status in each matched set in
|
match_var_names |
Name(s) of the match variable(s) in |
Returns a data.frame with the following columns:
Unique event times in cohort_skeleton
.
Number of events at each event time.
Number of subjects at risk at each event time.
If the NCC is matched on additional
confounders, each matching variable will be included as a column to the right
of strata
.
compute_km_weights
library(SamplingDesignTools) # With common entry time: data("mini_cohort") mini_cohort compute_risk_table(cohort = mini_cohort, t_name = "t", y_name = "status") # With staggered entry time: data("mini_cohort2") mini_cohort2 compute_risk_table(cohort = mini_cohort2, t_start_name = "t_start", t_name = "t_end", y_name = "status")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.