This R package is to implement the proposed method in the manuscript titled "New weighting methods when cases are only a subset of events in a nested case-control study."
NCCIPW
To install this R package, you need to first install the devtool
package via
install.packages("devtools")
To install the NCCIPW
package,
devtools::install_github("michellezhou2009/NCCIPW")
library(NCCIPW)
An example data myexample
is included in the package, and it is a simulated data from the simulation setting in the manuscript. The following gives the R code to fit a time-dependent generalized linear model, and the output includes the IPW estimates using the Horvitz-Thompson's weight for the model parameters (i.e., regression coefficients) and accuracy parameters (including AUC and others) as well as their perturbed counterparts.
data("myexample")
GLM.IPW(formula=Surv(time,status)~marker1+marker2,
data=myexample$data,
id="id",
case="case",
control="control",
m0=3,t0=1,
weight.type = "HT",
yes.match=T,control.matching=list(Mdat=myexample$Mdat,aM=myexample$aM),
yes.ptb=TRUE,control.ptb=list(n.ptb=10,CaseID="CaseID"))
The following gives the R code to fit a Cox proportional hazards model, and the output includes the IPW estimates using the Horvitz-Thompson's weight for the model parameters (i.e., regression coefficients) and accuracy parameters (including AUC and others) as well as their perturbed counterparts.
PH.IPW(formula=Surv(time,status)~marker1+marker2,
data=myexample$data,
id="id",
case="case",
control="control",
m0=3,t0=1,
weight.type = "HT",
yes.match=T,control.matching=list(Mdat=myexample$Mdat,aM=myexample$aM),
yes.ptb=TRUE,control.ptb=list(n.ptb=10,CaseID="CaseID"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.