Title: | Reference-Based Multiple Imputation for Ordinal/Binary Response |
---|---|
Description: | Reference-based multiple imputation of ordinal and binary responses under Bayesian framework, as described in Wang and Liu (2022) <arXiv:2203.02771>. Methods for missing-not-at-random include Jump-to-Reference (J2R), Copy Reference (CR), and Delta Adjustment which can generate tipping point analysis. |
Authors: | Ying Liu [aut], Tony Wang [aut, cre] |
Maintainer: | Tony Wang <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.2 |
Built: | 2024-11-09 04:23:36 UTC |
Source: | https://github.com/xsswang/remiod |
A data set containing the treatment and continuous responses measured at baseline and 4 post-baseline visits
antidep
antidep
A data frame with 172 rows and 6 variables:
Patient ID
Treatment, 1 for treated and 0 for placebo
HADM-17 measurement at the baseline
Change score of HADM-17 measurement at the post-baseline week 1, 2, 4, and 6.
https://www.lshtm.ac.uk/research/centres-projects-groups/missing-data#dia-missing-data
Internal function to obtain Copy-Reference(CR) MCMC from an MAR object.
clm_MI_CR(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, ord_cov_dummy = TRUE, seed = NULL, mess = FALSE, ...)
clm_MI_CR(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, ord_cov_dummy = TRUE, seed = NULL, mess = FALSE, ...)
object |
an object of class remoid |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
start |
first iteration to be used. |
end |
last iteration to be used. |
thin |
thinning to be applied. |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
ord_cov_dummy |
optional. specify whether ordinal variables should be treated as
categorical variables or continuous variables when they are
included as covariates in the sequential imputation models.
Default is |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Internal function to obtain delta-adjusted MCMC from an MAR object.
clm_MI_delta(object, treatment, delta = 0, start = NULL, end = NULL, exclude_chains = NULL, thin = NULL, subset = FALSE, ord_cov_dummy = TRUE, seed = NULL, mess = FALSE, ...)
clm_MI_delta(object, treatment, delta = 0, start = NULL, end = NULL, exclude_chains = NULL, thin = NULL, subset = FALSE, ord_cov_dummy = TRUE, seed = NULL, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
start |
first iteration to be used. |
end |
last iteration to be used. |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
thin |
thinning to be applied. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
ord_cov_dummy |
optional. specify whether ordinal variables should be treated as
categorical variables or continuous variables when they are
included as covariates in the sequential imputation models.
Default is |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Internal function to obtain Jump-to-Reference(J2R) MCMC from an MAR object.
clm_MI_J2R(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, ord_cov_dummy = TRUE, seed = NULL, mess = FALSE, ...)
clm_MI_J2R(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, ord_cov_dummy = TRUE, seed = NULL, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
start |
first iteration to be used. |
end |
last iteration to be used. |
thin |
thinning to be applied. |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
ord_cov_dummy |
optional. specify whether ordinal variables should be treated as
categorical variables or continuous variables when they are
included as covariates in the sequential imputation models.
Default is |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters .A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Extract a specified number of multiple imputed datasets
extract_MIdata(object, method = c("MAR", "J2R", "CR", "delta"), delta = 0, mi.setting = NULL, M = 10, minspace = 2, mess = FALSE)
extract_MIdata(object, method = c("MAR", "J2R", "CR", "delta"), delta = 0, mi.setting = NULL, M = 10, minspace = 2, mess = FALSE)
object |
object inheriting from class 'remoid' |
method |
a method for obtaining multiple-imputed dataset. Options include
|
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
mi.setting |
a list of arguments related to multiple imputation, including trtvar, algorithm, method, include, exclude_chains, thin, start, end, and seed. |
M |
number of imputed datasets |
minspace |
minimum number of iterations between iterations to be chosen as imputed values (to prevent strong correlation between imputed datasets in the case of high autocorrelation of the MCMC chains). |
mess |
logical; should messages be given? Default is TRUE. |
A data.frame
in which the imputed datasets are stacked onto
each other. The variable Imp_
indexes the imputation, while
.rownr
links the rows to the rows of the original data.
In cross-sectional datasets the variable .id
is added as
subject identifier.
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 100, thin = 2, warn = FALSE, seed = 1234) extdt = extract_MIdata(object=test, method="J2R",mi.setting=NULL, M=10, minspace=2)
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 100, thin = 2, warn = FALSE, seed = 1234) extdt = extract_MIdata(object=test, method="J2R",mi.setting=NULL, M=10, minspace=2)
Internal function, creates multiple imputed datasets based on assigned
imputation method returns multiple imputed datasets stacked
onto each other (i.e., long format; optionally including the original,
incomplete data).
get_MI_RB(object, treatment, method = c("MAR", "J2R", "CR", "delta"), delta = 0, exclude_chains = NULL, start = NULL, end = NULL, seed = NULL, thin = NULL, subset = FALSE, include = TRUE, ord_cov_dummy = TRUE, mess = TRUE, ...)
get_MI_RB(object, treatment, method = c("MAR", "J2R", "CR", "delta"), delta = 0, exclude_chains = NULL, start = NULL, end = NULL, seed = NULL, thin = NULL, subset = FALSE, include = TRUE, ord_cov_dummy = TRUE, mess = TRUE, ...)
object |
an object of class JointAI |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
method |
a method for obtaining multiple-imputed dataset. Options include MAR, J2R, CR, and Delta adjustment. |
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
start |
first iteration to be used. |
end |
last iteration to be used. |
seed |
optional seed value. |
thin |
thinning to be applied. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
include |
should the original, incomplete data be included? Default is
|
ord_cov_dummy |
optional. specify whether ordinal variables should be treated as
categorical variables or continuous variables when they are
included as covariates in the sequential imputation models.
Default is |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A data.frame
in which the original data (if
include = TRUE
) and the imputed datasets are stacked onto
each other.
The variable Imputation_
indexes the imputation, while
.rownr
links the rows to the rows of the original data.
In cross-sectional datasets the
variable .id
is added as subject identifier.
Internal function to extract information of imputation models.
get_Mlist(object)
get_Mlist(object)
object |
object inheriting from class |
a list include raw data, imputation models, model types, fixed effects, random effects if any, reference categories corresponding to categorical variables in models, and interaction terms.
Extract specific parameters from MCMC samples
get_subset(object, subset, warn = TRUE, mess = TRUE)
get_subset(object, subset, warn = TRUE, mess = TRUE)
object |
an object of class |
subset |
subset of parameters (columns of the mcmc object) to be used. See
https://nerler.github.io/JointAI/articles/SelectingParameters.html
for key-words of subseting parameters. Besides, |
warn |
logical, should warning messages be displayed? |
mess |
logical, should messages be displayed? |
data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 0, thin = 1, warn = FALSE, seed = 1234) pms = c("beta[2]","alpha[2]","alpha[6]","alpha[9]") mcsub = get_subset(object = test$mc.mar, subset=c(selected_parms = list(pms)))
data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 0, thin = 1, warn = FALSE, seed = 1234) pms = c("beta[2]","alpha[2]","alpha[6]","alpha[9]") mcsub = get_subset(object = test$mc.mar, subset=c(selected_parms = list(pms)))
Internal function to obtain Copy-Reference(CR) MCMC from an MAR object.
glm_MI_CR(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = 5432, mess = FALSE, ...)
glm_MI_CR(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = 5432, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
start |
first iteration to be used |
end |
last iteration to be used |
thin |
thinning to be applied |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output |
subset |
subset of parameters (columns of the mcmc object) to be used |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Internal function to obtain delta-adjusted MCMC from an MAR object.
glm_MI_delta(object, treatment, delta = 0, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = 5432, mess = FALSE, ...)
glm_MI_delta(object, treatment, delta = 0, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = 5432, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
start |
first iteration to be used |
end |
last iteration to be used |
thin |
thinning to be applied |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output |
subset |
subset of parameters (columns of the mcmc object) to be used |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Internal function to obtain Jump-to-Reference(J2R) MCMC from an MAR object.
glm_MI_J2R(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = 5432, mess = FALSE, ...)
glm_MI_J2R(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = 5432, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
start |
first iteration to be used |
end |
last iteration to be used |
thin |
thinning to be applied |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output |
subset |
subset of parameters (columns of the mcmc object) to be used |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Listing the sequence of models used for imputation
list.models(object, details = FALSE, print = TRUE)
list.models(object, details = FALSE, print = TRUE)
object |
an object of class |
details |
logical. Default is FALSE, where listing all models in formula format. If TRUE, details of each models will be presented. |
print |
logical. Default is TRUE to print all imputation models or detailed imputation models. |
a list of formula of imputation models. If details=TRUE
, information on the conditional
distributions of the covariates in each imputation models. Note: the sequence of conditional
models together specifies the joint distribution.
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 10, thin = 2, warn = FALSE, seed = 1234) list.models(test)
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 10, thin = 2, warn = FALSE, seed = 1234) list.models(test)
Visualizing the posterior sample Creates a set of plots for visually evaluating convergence and mixing of the chains from the MCMC sample of an object of class 'remiod'.
mcmcplot(object, what = c("trace", "density"), subset = c(analysis_main = TRUE), outcome = NULL, mi.setting = NULL, nrow = NULL, ncol = NULL, use_ggplot = TRUE, mess = TRUE, warn = FALSE, ...)
mcmcplot(object, what = c("trace", "density"), subset = c(analysis_main = TRUE), outcome = NULL, mi.setting = NULL, nrow = NULL, ncol = NULL, use_ggplot = TRUE, mess = TRUE, warn = FALSE, ...)
object |
an object inheriting from class 'remoid' |
what |
select either trace or density plots from MCMC samples |
subset |
subset of parameters/variables/nodes (columns in the MCMC
sample). Follows the same principle as the argument
|
outcome |
optional; vector identifying a subset of sub-models included in the output, either by specifying their indices (using the order used in the list of model formulas), or their names (LHS of the respective model formula as character string) |
mi.setting |
a list of arguments for extracting MI data set, which
will be used to update the one in |
nrow |
optional; number of rows in the plot layout; automatically chosen if unspecified |
ncol |
optional; number of columns in the plot layout; automatically chosen if unspecified |
use_ggplot |
logical; Should ggplot be used instead of the base graphics? |
mess |
logical; should messages be given? Default is
|
warn |
logical; should warnings be given? Default is
|
... |
Arguments passed on to
|
plots of traces or densities of MCMC samples for selected parameters in imputation models.
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 10, thin = 2, warn = FALSE, seed = 1234) p1 = mcmcplot(object=test, what="trace")
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 10, thin = 2, warn = FALSE, seed = 1234) p1 = mcmcplot(object=test, what="trace")
extract_MIdata()
function)
and runs an analysis function on each of them.Takes multiply imputed datasets (as generated by the extract_MIdata()
function)
and runs an analysis function on each of them.
miAnalyze(formula, family = NULL, data, pool = TRUE)
miAnalyze(formula, family = NULL, data, pool = TRUE)
formula |
a two sided model formula (see |
family |
only for |
data |
the output object of |
pool |
logical. If TRUE, estimates from each imputed data set will be pooled together according to Rubin's rules. Default is TRUE. |
rubin_rules
applies Rubin's rules (Rubin, 1987) for pooling together
the results from a multiple imputation procedure. The pooled point Estimate
is
is the average across the point estimates from the complete-data analyses.
The SE
is the square-root of the sum of two terms representing the within-variance
and the between-variance (see Little-Rubin (2002)). The function also returns
95% confidence interval, based on the estimated pooled degrees of freedom
that can be used for inference based on the t-distribution.
A list containing
list of estimated coefficients and standard error from each imputed data.
pooled estimates based Rubin's rule if pool = TRUE
.
Internal function to obtain Copy-Reference(CR) MCMC from an MAR object.
opm_MI_CR(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = NULL, mess = FALSE, ...)
opm_MI_CR(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = NULL, mess = FALSE, ...)
object |
an object of class remoid |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
start |
first iteration to be used. |
end |
last iteration to be used. |
thin |
thinning to be applied. |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Internal function to obtain delta-adjusted MCMC from an MAR object.
opm_MI_delta(object, treatment, delta = 0, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = NULL, mess = FALSE, ...)
opm_MI_delta(object, treatment, delta = 0, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = NULL, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
start |
first iteration to be used. |
end |
last iteration to be used. |
thin |
thinning to be applied. |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters.A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Internal function to obtain Jump-to-Reference(J2R) MCMC from an MAR object.
opm_MI_J2R(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = NULL, mess = FALSE, ...)
opm_MI_J2R(object, treatment, start = NULL, end = NULL, thin = NULL, exclude_chains = NULL, subset = FALSE, seed = NULL, mess = FALSE, ...)
object |
an object of class remiod |
treatment |
the variable name of treatment. Reference level of treatment should be coded as 0. |
start |
first iteration to be used. |
end |
last iteration to be used. |
thin |
thinning to be applied. |
exclude_chains |
optional vector of numbers, indexing MCMC chains to be excluded from the output. |
subset |
subset of parameters (columns of the mcmc object) to be used. |
seed |
optional seed value. |
mess |
logical, should messages be displayed? |
... |
optional arguments pass from main function. |
A matrix of MCMC samples with all monitored parameters .A subset of
the MCMC sample can be selected using start
, end
and
thin
.
Reference-Based Multiple Imputation for Ordinal/Binary Response
remiod(formula, data, trtvar, refcats = NULL, family = NULL, method = "MAR", delta = 0, algorithm = c("tang_seq", "jags"), rinv = 1e-04, scheme = 2, model_order = NULL, models = NULL, ord_cov_dummy = TRUE, n.chains = 2, n.adapt = 100, n.iter = 1000, thin = 2, start = NULL, end = NULL, seed = 1234, exclude_chains = NULL, subset = NULL, include = FALSE, mess = TRUE, warn = FALSE, progress.bar = TRUE, ...)
remiod(formula, data, trtvar, refcats = NULL, family = NULL, method = "MAR", delta = 0, algorithm = c("tang_seq", "jags"), rinv = 1e-04, scheme = 2, model_order = NULL, models = NULL, ord_cov_dummy = TRUE, n.chains = 2, n.adapt = 100, n.iter = 1000, thin = 2, start = NULL, end = NULL, seed = 1234, exclude_chains = NULL, subset = NULL, include = FALSE, mess = TRUE, warn = FALSE, progress.bar = TRUE, ...)
formula |
a two sided model formula (see |
data |
a |
trtvar |
the name of treatment variable. When necessary, its reference category,
i.e. control arm, can be set in |
refcats |
optional; either one of |
family |
only for |
method |
a method for obtaining multiple-imputed dataset. Options include
|
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
algorithm |
either algorithm |
rinv |
a small number used to adjusting Fish information matrix |
scheme |
scheme of distribution used for proposing coefficients of imputation models. scheme=1: beta ~ N( mean + inv(I)*score, inv(I)); scheme=2: beta ~ N( mean , inv(I)). |
model_order |
optional. manually specify an order for imputation models. |
models |
optional; named vector specifying the types of models for
(incomplete) covariates.
This arguments replaces the argument |
ord_cov_dummy |
optional. specify whether ordinal variables should be treated as
categorical variables or continuous variables when they are
included as covariates in the sequential imputation models.
Default is |
n.chains |
number of MCMC chains |
n.adapt |
number of iterations for adaptation of the MCMC samplers
(see |
n.iter |
number of iterations of the MCMC chain (after adaptation;
see |
thin |
thinning interval (integer; see |
start |
the first iteration of interest
(see |
end |
the last iteration of interest
(see |
seed |
optional; seed value (for reproducibility) |
exclude_chains |
optional vector of the index numbers of chains that should be excluded |
subset |
subset of parameters/variables/nodes (columns in the MCMC
sample). Follows the same principle as the argument
|
include |
logical, if TRUE, raw data will be included in imputed data sets with imputation ID = 0. |
mess |
logical; should messages be given? Default is
|
warn |
logical; should warnings be given? Default is
|
progress.bar |
character string specifying the type of
progress bar. Possible values are "text" (default), "gui",
and "none" (see |
... |
additional, optional arguments
|
A list includes (1) Information from JAGS modeling and MCMC samples
and (2) A data.frame
in which the original data (if
include = TRUE
) and the imputed datasets are stacked onto
each other.
The variable Imputation_
indexes the imputation, while
.rownr
links the rows to the rows of the original data.
In cross-sectional datasets the
variable .id
is added as subject identifier.
data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 10, thin = 2, warn = FALSE, seed = 1234)
data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 10, n.chains = 1, n.iter = 10, thin = 2, warn = FALSE, seed = 1234)
Schizophrenia data from a randomized controlled trial with patients assigned to either drug or placebo group. "Severity of Illness" was measured, at weeks 0, 1, ..., 6, on a four category ordered scale. Most of the observations where made on weeks 0, 1, 3, and 6.
data(schizo)
data(schizo)
A data frame with 1603 observations on 437 subjects. Five vectors contain information on
id
patient ID.
imps79
original response measurements on a numerical scale.
imps79b
binary response based on the cut-off value of 3.5 to the measurements on a numerical scale: 0 = normal to mildly ill and 1 = moderately to extremely ill
imps79o
ordinal response on a 4 category scale, "normal or borderline mentally ill" < "mildly or moderately ill", "markedly ill", "severely or among the most extremely ill".
tx
treatment indicator: 1 for drug, 0 for placebo.
week
week.
The documentation file was copied from the mixcat package and slightly modified.
https://hedeker.people.uic.edu/ml.html
Hedeker, D. and R. Gibbons (2006). Longitudinal Data Analysis. New Jersey, USA: John Wiley & Sons.
A dataset containing the treatment and binary responses measured at baseline and 3 post-baseline visits
schizob
schizob
A data frame with 437 rows and 5 variables:
treatment, 1 for treated and 0 for placebo
binary response at the baseline
binary response at the post-baseline week 1, 3, and 6.
long-to-wise tranformation of schizo data, i.e. schizob = data.table::dcast(schizo, id + tx ~ week, value.var = "imps79b")
A dataset containing the treatment and ordinal responses measured at baseline and 3 post-baseline visits
schizow
schizow
A data frame with 437 rows and 5 variables:
treatment, 1 for treated and 0 for placebo
ordinal response at the baseline
ordinal response at the post-baseline week 1, 3, and 6.
long-to-wise tranformation of schizo data, i.e. schizow = data.table::dcast(schizo, id + tx ~ week, value.var = "imps79o")
Obtain and print the summary
, (fixed effects) coefficients
(coef
) and credible interval (confint
).
summary(object, ...) ## S3 method for class 'remiod' summary(object, start = NULL, end = NULL, thin = NULL, quantiles = c(0.025, 0.975), outcome = NULL, exclude_chains = NULL, warn = TRUE, mess = TRUE, ...) ## S3 method for class 'summary.remiod' print(x, digits = 3, ...) ## S3 method for class 'summary.remiod' coef(object, start = NULL, end = NULL, thin = NULL, subset = NULL, exclude_chains = NULL, warn = TRUE, mess = TRUE, ...)
summary(object, ...) ## S3 method for class 'remiod' summary(object, start = NULL, end = NULL, thin = NULL, quantiles = c(0.025, 0.975), outcome = NULL, exclude_chains = NULL, warn = TRUE, mess = TRUE, ...) ## S3 method for class 'summary.remiod' print(x, digits = 3, ...) ## S3 method for class 'summary.remiod' coef(object, start = NULL, end = NULL, thin = NULL, subset = NULL, exclude_chains = NULL, warn = TRUE, mess = TRUE, ...)
object |
object inheriting from class 'remoid' |
... |
additional, optional arguments
|
start |
the first iteration of interest
(see |
end |
the last iteration of interest
(see |
thin |
thinning interval (integer; see |
quantiles |
posterior quantiles |
outcome |
specify outcome variable to select imputation model(s) to summarize. Default generates summaries for all models. |
exclude_chains |
optional vector of the index numbers of chains that should be excluded |
warn |
logical; should warnings be given? Default is
|
mess |
logical; should messages be given? Default is
|
x |
an object of class |
digits |
the minimum number of significant digits to be printed in values. |
subset |
subset of parameters/variables/nodes (columns in the MCMC
sample). Follows the same principle as the argument
|
summary information, including parameter posterior mean, posterior SD,
quantiles, tail probability tail-prob
, Gelman-Rubin criterion
GR-crit
, the ratio of the Monte Carlo error and posterior standard
deviation) for specified parameters MCE/SD
.
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 50, n.chains = 1, n.iter = 50, thin = 2, warn = FALSE, seed = 1234) summary(object = test, outcome = c("y6","y3"))
# data(schizow) test = remiod(formula = y6 ~ tx + y0 + y1 + y3, data = schizow, trtvar = 'tx', algorithm = 'jags', method="MAR", ord_cov_dummy = FALSE, n.adapt = 50, n.chains = 1, n.iter = 50, thin = 2, warn = FALSE, seed = 1234) summary(object = test, outcome = c("y6","y3"))
Internal function, creates multiple imputed datasets based on assigned imputation method with the algorithm of Tang's sequential modeling.
tang_MI_RB(object, dtimp, treatment, method = "MAR", delta = 0, ord_cov_dummy = FALSE, exclude_chains = NULL, include = FALSE, thin = 1)
tang_MI_RB(object, dtimp, treatment, method = "MAR", delta = 0, ord_cov_dummy = FALSE, exclude_chains = NULL, include = FALSE, thin = 1)
object |
object inheriting from class 'remoid' |
dtimp |
imputed complete data sets from |
treatment |
name of the treatment variable. |
method |
a method for obtaining multiple-imputed dataset. Options include
|
delta |
specific value used for Delta adjustment, applicable only for method="delta". |
ord_cov_dummy |
optional. specify whether ordinal variables should be treated as
categorical variables or continuous variables when they are
included as covariates in the sequential imputation models.
Default is |
exclude_chains |
optional vector of the index numbers of chains that should be excluded |
include |
logical, if TRUE, raw data will be included in imputed data sets with imputation ID = 0. |
thin |
thinning to be applied. |
multiple imputed datasets stacked onto each other (i.e., long format;
optionally including the original incomplete data).
The variable Imputation_
indexes the imputation, while
.rownr
links the rows to the rows of the original data.
In cross-sectional datasets the
variable .id
is added as subject identifier.