skipTrack.simulate | R Documentation |
This function generates synthetic data for user-tracked menstrual cycles given a generative model, skip probabilities, maximum cycles and covariates (depending on the model). It supports built-in models ('skipTrack', 'li', 'mixture') and custom models written as functions.
skipTrack.simulate(
n,
model = c("skipTrack", "li", "mixture"),
skipProb = NULL,
maxCycles = length(skipProb),
trueBetas = NULL,
trueGammas = NULL,
overlap = 0,
avgCyclesPer = 7
)
n |
Number of individuals to simulate data for. |
model |
model for data simulation. Can be a character ('skipTrack', 'li', 'mixture') or a custom function. |
skipProb |
Vector of probabilities for number of true cycles per tracked cycle. For example, (.7, .2, .1) means that 70% of observed cycles will contain one true cycle, 20% will contain 2 true cycles and 10% will contain 3 true cycles. Default is NULL. If model == 'li', skipProb values are set and user input will be ignored. |
maxCycles |
Maximum number of cycles for generating skip cycles. Default is the length of skipProb. If model == 'li', this must be specified; if model == 'skipTrack' or 'mixture', leave as default. |
trueBetas |
Optional. True values for the mean regression coefficients (not counting intercept which is automatic based on the model). |
trueGammas |
Optional. True values for the precision regression coefficients (not counting intercept which is automatic based on the model). Precision covariates not available for model == 'li'. |
overlap |
Optional. Number of (non-intercept) columns shared between X and Z. Columns are shared from left to right. |
avgCyclesPer |
Average number of cycles contributed by each individual. Actual number is drawn from Poisson for each person. Default is 7. |
A list containing:
Tracked cycles from the simulated data.
Individual identifiers from the simulated data.
Covariate matrix for Betas (mean cycle length).
Covariate matrix for Gammas (regularity).
True beta coefficients.
True gamma coefficients.
Number of true cycles in each tracked cycle. Order matches Y.
Subset of the simulated data containing individual level information. For 'skipTrack' - individual mean and precision for log(cycle lengths), for 'li' - individual mean for cycle lengths, for 'mixture' - individual mean for cycle lengths
Li, Kathy, et al. "A predictive model for next cycle start date that accounts for adherence in menstrual self-tracking." Journal of the American Medical Informatics Association 29.1 (2022): 3-11.
stSim
, liSim
, mixSim
# Example simulation from the SkipTrack model
resultSt <- skipTrack.simulate(1000, model = 'skipTrack', skipProb = c(.7, .2, .1))
hist(resultSt$Y, breaks = 5:200)
# Example simulation from the Li model
resultLi <- skipTrack.simulate(1000, model = 'li', maxCycles = 3)
hist(resultLi$Y, breaks = 5:200)
#Example simulation from the mixture model
resultMix <- skipTrack.simulate(1000, model = 'mixture', skipProb = c(.7, .2, .1))
hist(resultMix$Y, breaks = 5:200)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.