match_risk_table: <Private function> Match number at risk at coarsened time to...

View source: R/km_type_weights.R

match_risk_tableR Documentation

<Private function> Match number at risk at coarsened time to NCC cases

Description

<Private function> Match number at risk at coarsened time to NCC cases

Usage

match_risk_table(
  ncc_cases,
  risk_table_manual,
  t_coarse_name,
  t_name,
  match_var_names = NULL
)

Arguments

ncc_cases

Cases in NCC data. A data.frame or a matrix with column names. This data should not include the ID of each matched set.

risk_table_manual

A data.frame with columns t_event (unique event times, possibly coarsened), n_at_risk (number of subjects at risk at each t_event in the underlying cohort), and additional columns for matching variables, if any. Make sure the matching variables have the same column names as in ncc_cases and match_var_names.

t_coarse_name

Name of the column of event time in each matched set in ncc, possibly coarsened to the same level as t_event in risk_table_manual. A string.

t_name

Name of the column of the exact event time. A string.

match_var_names

Name(s) of the match variable(s) in ncc_cases used when drawing the NCC. A string vector.

Value

Returns a data.frame with the following columns:

t_event

Unique event times (exact, not coarsened).

n_event

Number of events at each event time.

n_at_risk

Number of subjects at risk at each event time.

strata

Strata defined by matching variables. match_var=1 if the NCC is only time-matched.

<each matching variable>

If the NCC is matched on additional confounders, each matching variable will be included as a column to the right of strata.


nyilin/SamplingDesignTools documentation built on Nov. 20, 2022, 8:07 a.m.