matchReport: matchReport - report of matching from riskSetMatch

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/matchReport.R

Description

The function provides very simple tables of the success of finding controls and the reuse of cases and controls. Designed to deal with the results of function riskSetMatch

Usage

1
matchReport(dat, id, case, caseid,oldcase="oldevent")

Arguments

dat

- data.table with result from riskSetMatch

id

- variable with participant id

case

- 0=control, 1=case

caseid

- variable defining the groups of matching cases/controls

oldcase

- Variable holding case/control=0/1 prior to matching. Distinguishes cases reused as controls

Details

This function can be helpful to define matching options. If there is excessive reuse of controls or many cases do not find controls it may be desirable to do further rounding of matching variables.

Value

Three small tables - Number of controls for cases, use/reuse of controls, use/reuse of cases

Author(s)

Christian Torp-Pedersen

See Also

riskSetMatch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require(data.table)
case <- c(rep(0,40),rep(1,15)) 
ptid <- paste0("P",1:55)
sex <- c(rep("fem",20),rep("mal",20),rep("fem",8),rep("mal",7))
byear <- c(rep(c(2020,2030),20),rep(2020,7),rep(2030,8))
caseIndex <- c(seq(1,40,1),seq(5,47,3))
controlIndex <- caseIndex
library(data.table)
dat <- data.table(ptid,case,sex,byear,caseIndex,controlIndex)
# Very simple match without reuse - no dates to control for
dataout <- riskSetMatch("ptid","case",c("byear","sex"),dat,2,caseIndex="caseIndex",
  controlIndex="controlIndex",reuseCases=TRUE,reuseControls=TRUE)
matchReport(dataout,"ptid","case","caseid")   

tagteam/heaven documentation built on Feb. 16, 2019, 8:21 p.m.