Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 2.15 KB

README.md

File metadata and controls

64 lines (50 loc) · 2.15 KB

Non-parametric estimation of the covariate-adjusted threshold-response function

This package implements the non-parametric estimation of the covariate-adjusted threshold-response function. More information about these methods is provided in the published paper.

Developed by

Install

Tested on R 4.4.0

devtools::install_github("tlverse/sl3")
devtools::install_github("tlverse/tmle3")
devtools::install_github("CoVPN/npthreshold")

Using the package

With time-to-event outcomes (account for right-censoring)

library(npthreshold)
library(sl3)

# estimates the threshold-response function across specified thresholds
res <- thresholdSurv(data = thresh_sample,
                     covariates = c("W1", "W2"), 
                     failure_time = "time",
                     event_type = "event", 
                     marker = "A", 
                     weights = NULL, 
                     threshold_list = c(40, 50, 60, 70, 80),
                     tf = 15, 
                     learner.treatment = Lrnr_glm$new(),
                     learner.event_type = Lrnr_glm$new(),
                     learner.failure_time = Lrnr_glm$new(),
                     learner.censoring_time = Lrnr_glm$new(), 
                     verbose = FALSE)

# creates a graph of this estimated function with confidence intervals
graphthresh(res)

With binary outcomes

library(npthreshold)
library(SuperLearner)

# estimates the threshold-response function across specified thresholds
res <- thresholdBinary(data = thresh_sample,
                       covariates = c("W1", "W2"), 
                       outcome = "event", 
                       marker = "A", 
                       threshold_list = c(40, 50, 60, 70, 80),
                       Delta = NULL, # no missing outcomes
                       weights = NULL, # all equally weighted
                       sl_library = c("SL.mean", "SL.glm"))

# creates a graph of this estimated function with confidence intervals
graphthresh(res)