liMCMC | R Documentation |
This function performs inference on cycle length data, assuming the model from Li et al. (2022). It is important to note that Li et al. does not actually use this algorithm as they target a particular analytic posterior predictive distribution, and solve directly. However, we are targeting a different posterior and thus use this MCMC to perform inference.
liMCMC(
Y,
cluster,
S,
hyperparams = c(kappa = 180, gamma = 6, alpha = 2, beta = 20),
initialParams = list(pi = c(1/3, 1/3, 1/3), lambdais = rep(30,
length(unique(cycleDat$Individual))), piis = rep(0.2,
length(unique(cycleDat$Individual))), ss = sample(0:S, nrow(cycleDat), replace =
TRUE)),
reps = 1000,
...
)
Y |
A vector of observed cycle lengths. |
cluster |
A vector indicating the individual cluster/group membership for each observation Y. |
S |
Integer. The maximum number of skips to consider possible. |
hyperparams |
Named numeric vector of hyperparameters containing the elements: kappa, gamma, alpha, beta. NOTE: MUST BE IN CORRECT ORDER.
|
initialParams |
A list of initial parameter values for the MCMC algorithm. Default values are provided for pi, lambdais, piis, ss. |
reps |
The number of MCMC iterations (steps) to perform. Default is 1000. |
... |
For catching unused arguments (like li = TRUE) |
A list containing the MCMC draws for each parameter at each iteration. Each element in the list is itself a list containing:
A data.frame with updated parameters at the individual-observation level: Individual, ys, lambdais, piis, ss.
A data.frame with updated parameters at the individual level: Individual, lambdas, pis.
Fixed value of hyperparameter kappa.
Fixed value of hyperparameter gamma.
Fixed value of hyperparameter alpha.
Fixed value of hyperparamter beta.
Fixed input value S.
A logical vector indicating the first occurrence of each individual.
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.
gibbsStepLi
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.