liMCMC {skipTrack}R Documentation

Runs MCMC algorithm for performing inference using the model from Li et al. (2022)

Description

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.

Usage

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
)

Arguments

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.

  • kappa: Numeric value, shape parameter of Gamma distribution for Lambda_i.

  • gamma: Numeric value, rate parameter of Gamma distribution for Lambda_i.

  • alpha: Numeric value, shape1 parameter of Beta distribution for Pi_i.

  • beta: Numeric value, shape2 parameter of Beta distribution for Pi_i.

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.

Value

A list containing the MCMC draws for each parameter at each iteration. Each element in the list is itself a list containing:

ijDat

A data.frame with updated parameters at the individual-observation level: Individual, ys, lambdais, piis, ss.

iDat

A data.frame with updated parameters at the individual level: Individual, lambdas, pis.

kappa

Fixed value of hyperparameter kappa.

gamma

Fixed value of hyperparameter gamma.

alpha

Fixed value of hyperparameter alpha.

beta

Fixed value of hyperparamter beta.

S

Fixed input value S.

indFirst

A logical vector indicating the first occurrence of each individual.

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

gibbsStepLi


[Package skipTrack version 0.1.0 Index]