nestedCC: Generate a nested case-control design

Description Usage Arguments Value Examples

View source: R/nestedCC_function.R

Description

Given a data frame with cohort data, this function will return a a randomly sampled nested case-control design

Usage

1
nestedCC(cohort, exit, event, match, k = 1, seed)

Arguments

cohort

Data frame with cohort data

exit

Variable in data frame with event/censoring times, specified as position (integer) or name (character)

event

Integer variable in cohort indicating censoring (0) or event (>0)

match

Optional vector of variables in cohort that cases and controls will be matched on

k

Number of controls per case; default 1

seed

Optional seed for random number generation

Value

A data frame with rows from the input data (possibly sampled repeatedly) and an extra column 'matchSet' indicating matched sets of cases and controls.

Examples

1
2
3
ex1 = nestedCC(cohort, exit = "time", event = "cvd", match = "sex", k = 1, seed = 43)
str(ex1)
head(ex1$data)

alexploner/nestedCC documentation built on Dec. 1, 2019, 12:30 a.m.