| BMRMM | R Documentation |
Provides inference results of both transition probabilities and duration times using BMRMMs.
BMRMM(
data,
num.cov,
cov.labels = NULL,
state.labels = NULL,
random.effect = TRUE,
fixed.effect = TRUE,
trans.cov.index = 1:num.cov,
duration.cov.index = 1:num.cov,
duration.distr = NULL,
duration.incl.prev.state = TRUE,
simsize = 10000,
burnin = simsize/2
)
data |
a data frame containing – individual ID, covariate values, previous state, current state, duration times (if applicable), in that order. |
num.cov |
total number of covariates provided in |
cov.labels |
a list of vectors giving names of the covariate levels. Default is a list of numerical vectors. |
state.labels |
a vector giving names of the states. Default is a numerical vector. |
random.effect |
|
fixed.effect |
|
trans.cov.index |
a numeric vector indicating the indices of covariates that are used for transition probabilities. Default is all of the covariates. |
duration.cov.index |
a numeric vector indicating the indices of covariates that are used for duration times. Default is all of the covariates. |
duration.distr |
a list of arguments indicating the distribution of duration times. Default is |
duration.incl.prev.state |
|
simsize |
total number of MCMC iterations. Default is 10000. |
burnin |
number of burn-ins for the MCMC iterations. Default is |
Users have the option to ignore duration times or model duration times as
a discrete or continuous variable via defining duration.distr.
duration.distr can be one of the following:
NULL: duration times are ignored. This is the default setting.
list('mixgamma', shape, rate): duration times are modeled as a mixture gamma variable. shape and rate
must be numeric vectors of the same length. The length indicates the number of mixture components.
list('mixDirichlet', unit): duration times are modeled as a new state with discretization unit. The duration
state is then analyzed along with the original states. For example, if an duration time entry is 20 and unit is 5,
then the model will add 4 consecutive new states. If an duration time entry is 23.33 and unit is 5, then the model
will still add 4 consecutive new states as the blocks are calculated with the floor operation.
An object of class BMRMM consisting of results.trans and results.duration if duration times are analyzed as a continuous variable.
The field results.trans is a data frame giving the inference results of transition probabilities.
covs | covariates levels for each row of the data. |
dpreds | maximum level for each related covariate. |
MCMCparams | MCMC parameters including simsize, burnin and thinning factor. |
tp.exgns.post.mean | posterior mean of transition probabilities for different combinations of covariates. |
tp.exgns.post.std | posterior standard deviation of transition probabilities for different combinations of covariates. |
tp.anmls.post.mean | posterior mean of transition probabilities for different individuals. |
tp.anmls.post.std | posterior standard deviation of transition probabilities for different individuals. |
tp.all.post.mean | posterior mean of transition probabilities for different combinations of covariates AND different individuals. |
tp.exgns.diffs.store | difference in posterior mean of transition probabilities for every pair of covariate levels given levels of the other covariates. |
tp.exgns.all.itns | population-level transition probabilities for every MCMC iteration. |
clusters | number of clusters for each covariate for each MCMC iteration. |
cluster_labels | the labels of the clusters for each covariate for each MCMC iteration. |
type | a string identifier for results, which is "Transition Probabilities". |
cov.labels | a list of string vectors giving labels of covariate levels. |
state.labels | a list of strings giving labels of states. |
The field results.duration is a data frame giving the inference results of duration times.
covs | covariates related to duration times. |
dpreds | maximum level for each related covariate. |
MCMCparams | MCMC parameters: simsize, burnin and thinning factor. |
duration.times | duration times from the data set. |
comp.assignment | mixture component assignment for each data point in the last MCMC iteration. |
duration.exgns.store | posterior mean of mixture probabilities for different combinations of covariates of each MCMC iteration. |
marginal.prob | estimated marginal mixture probabilities for each MCMC iteration. |
shape.samples | estimated shape parameters for gamma mixtures for each MCMC iteration. |
rate.samples | estimated rate parameters for gamma mixtures for each MCMC iteration. |
clusters | number of clusters for each covariate for each MCMC iteration. |
cluster_labels | the labels of the clusters for each covariate for each MCMC iteration. |
type | a string identifier for results, which is "Duration Times". |
cov.labels | a list of string vectors giving labels of covariate levels. |
Yutong Wu, yutong.wu@utexas.edu
# In the examples, we use a shorted version of the foxp2 dataset, foxp2sm
# ignores duration times and only models transition probabilities using all three covariates
results <- BMRMM(foxp2sm, num.cov = 2, simsize = 50)
# models duration times as a continuous variable with 3 gamma mixture components,
results <- BMRMM(foxp2sm, num.cov = 2, simsize = 50,
duration.distr = list('mixgamma', shape = rep(1,3), rate = rep(1,3)))
# models duration times as a discrete state with discretization 0.025 and
results <- BMRMM(foxp2sm, num.cov = 2, simsize = 50,
duration.distr = list('mixDirichlet', unit = 0.025))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.