Simulate survival data for MaxSPRT computation
simulateMaxSprtData( n = 10000, pExposure = 0.5, backgroundHazard = 0.001, tar = 10, nullMu = 0.2, nullSigma = 0.2, maxT = 100, looks = 10, numberOfNegativeControls = 50, numberOfPositiveControls = 1, positiveControlEffectSize = 4 )
Number of subjects.
Probability of being in target cohort.
Background hazard (risk of the outcome per day).
Time at risk for each exposure
Null distribution mean (at log HR scale)
Null distribution SD (at log HR scale)
Maximum time to simulate.
Number of (evenly spaced) looks at the data.
Number of negative controls to simulate.
Number of positive controls to simulate.
The true effect size of the positive controls.
A data frame with 5 variables:
Time from index date to either the event or end of observation, whichever came first
Whether the outcome occurred (1) or not (0)
Whether the subject was exposed (TRUE) or not (FALSE)
The time point when the look occurred.
A unique identifier for data corresponding to a single outcome. Lower IDs indicate negative controls, higher IDs indicate the positive control
Simulate survival data for negative and positive controls. The data provides multiple looks at data accruing over time, with each look having more data than the one before. Systematic error for each outcome is drawn from the prespecified null distribution.
The outcome IDs are assigned sequentially starting at 1, with the first IDs used for the negative controls, and the latter IDs used for the positive controls.
data <- simulateMaxSprtData(n = 1000) head(data) #> time outcome exposure lookTime outcomeId #> 29 7.078686 0 FALSE 10 1 #> 51 2.834933 0 TRUE 10 1 #> 53 5.614197 0 TRUE 10 1 #> 54 9.050227 0 TRUE 10 1 #> 57 5.867297 0 FALSE 10 1 #> 64 8.264407 0 TRUE 10 1