knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The flow of the SEQuential R package never changes, nor are there planned changes to this flow in the future.
In your R script, you will always start by defining your options object, through the SEQopts
helper. There are many defaults which allow you to target exactly how you would like to change your analysis. Through this wiki there are specific pages dedicated to each causal contrast and the parameters which affect them, but for simplicity let's start with an intention-to-treat analysis with 20 bootstrap samples.
library(SEQTaRget) options <- SEQopts(km.curves = TRUE, #asks the function to return survival and risk estimates bootstrap = TRUE, #asks the model to preform bootstrapping bootstrap.nboot = 10) #asks the model for 10 bootstrap samples
In general, options will be in the form {option}.{parameter}
- here you may notice that we use bootstrap.nboot
indicating that this parameter affects the bootstrap
The next step is running the primary R function, SEQuential
. Here you will give your options, data, and data-level information. We provide some small simulated datasets to test on.
data <- SEQdata model <- SEQuential(data, id.col = "ID", time.col = "time", eligible.col = "eligible", treatment.col = "tx_init", outcome.col = "outcome", time_varying.cols = c("N", "L", "P"), fixed.cols = "sex", method = "ITT", options = options)
SEQuential
is a rather chunky algorithm and will take some time to run, especially when bootstrapping. We provide some print statements to help track where the function is processing at any given point in time.
SEQuential
produces a lot of internal diagnostics, models, and dataframes out of its main function in an S4 class. We provide a few different methods to handle obtaining your results.
outcome(model) # Returns a list of only the outcome models km_curve(model) # Prints the survival curve
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.