skipTrack.fit {skipTrack} | R Documentation |
Fits the skipTrack Model using 1 or more MCMC chains
Description
This function fits the model using multiple instances of skipTrack.MCMC, either in parallel or sequentially.
Usage
skipTrack.fit(
Y,
cluster,
X = matrix(1, nrow = length(cluster)),
Z = matrix(1, nrow = length(cluster)),
numSkips = 10,
reps = 1000,
chains,
useParallel = FALSE,
...
)
Arguments
Y |
A vector of observed cycle lengths. |
cluster |
A vector indicating the individual cluster/group membership for each observation Y. |
X |
A matrix (length(Y) x length(Beta)) of covariates for cycle length mean. Default is a vector of 1's. |
Z |
A matrix (length(Y) x length(Gamma)) of covariates for cycle length precision. Default is a vector of 1's. |
numSkips |
The maximum number of skips to allow. Default is 10. |
reps |
The number of MCMC iterations (steps) to perform. Default is 1000. |
chains |
Number of chains to run. |
useParallel |
Logical, indicating whether to use parallel processing, as supported by doParallel. Default is FALSE. |
... |
Arguments passed on to
|
Value
A list containing the results of skipTrack.MCMC for each chain.
See Also
Examples
#Simulated data
simDat <- skipTrack.simulate(n = 100, skipProb = c(.7, .2, .1))
#Run model fit (should typically run with much more than 50 reps)
modFit <- skipTrack.fit(Y = simDat$Y, cluster = simDat$cluster, chains = 2, reps = 50)
modFit