skipTrack.simulate {skipTrack}R Documentation

Simulate user-tracked menstrual cycle data for multiple individuals

Description

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.

Usage

skipTrack.simulate(
  n,
  model = c("skipTrack", "li", "mixture"),
  skipProb = NULL,
  maxCycles = length(skipProb),
  trueBetas = NULL,
  trueGammas = NULL,
  overlap = 0
)

Arguments

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.

Value

A list containing:

'Y'

Tracked cycles from the simulated data.

'cluster'

Individual identifiers from the simulated data.

'X'

Covariate matrix for Betas (mean cycle length).

'Z'

Covariate matrix for Gammas (regularity).

'Beta'

True beta coefficients.

'Gamma'

True gamma coefficients.

'NumTrue'

Number of true cycles in each tracked cycle. Order matches Y.

'Underlying'

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

References

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.

See Also

stSim, liSim, mixSim

Examples

# 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)


[Package skipTrack version 0.1.0 Index]