Code Monkey home page Code Monkey logo

xsswang / remiod Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.61 MB

R package for controlled multiple imputation of ordinal or binary responses with missing data in clinical study

Home Page: https://xsswang.github.io/remiod

License: GNU General Public License v2.0

R 25.04% HTML 74.96%
reference-based multiple-imputation ordinal-regression generalized-linear-models jags missing-data glm pattern-mixture-model bayesian mcmc missing-at-random missing-not-at-random non-ignorable control-based jump-to-reference copy-reference delta-adjustment r-package statistics

remiod's Introduction

remiod: Reference-based Multiple Imputation of Longitudinal Binary and Ordinal Outcomes with non-ignorable missingness

CRAN Status CRAN Downloads GPL-3.0 R build status

The package remiod provides functionality to perform controlled multiple imputation of binary and ordinal response in the Bayesian framework. Implemented are (generalized) linear regression models for binary data and cumulative logistic models / ordered probit models for ordered categorical data (Wang and Liu 2022). It is also possible to fit multiple models of mixed types simultaneously. Missing values in variables(if present) will be imputed automatically.

remiod has two algorithmic backend. One is JAGS, with which the function performs some preprocessing of the data and creates a JAGS model, which will then automatically be passed to JAGS with the help of the R package rjags. The another is based on the method proposed by Tang (Tang 2018).

Besides the main modelling functions, remiod also provides functions to summarize and visualize results.

Installation

remiod Can be from CRAN:

install.packages("remiod")

Or, it can be installed from GitHub:

# install.packages("remotes")
remotes::install_github("xsswang/remiod")

Main functions

remiod provides the following main functions:

remiod                      #processing data and implementing MCMC sampling
extract_MIdata              #extract imputed data sets
miAnalyze                   #Perform analyses using imputed data and pool results

Currently, methods remiod implements include missing at random (MAR), jump-to-reference (J2R), copy reference (CR), and delta adjustment (delta). For method = "delta", argument delta should follow to specify a numerical values used in delta adjustment. These methods can be requested through extract_MIdata(), and imputed datasets can be analyzed using miAnalyze().

Functions summary(), coef(), and mcmcplot() provide a summary of the posterior distribution under MAR and its visualization.

Minimal Example

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)
result = miAnalyze(y6 ~ y0 + tx, data = extdt, pool = TRUE)

Support

For any help with regards to using the package or if you find a bug please create a GitHub issue.

Reference

Erler, NS, D Rizopoulos, and EMEH Lesaffre. 2021. “JointAI: Joint Analysis and Imputation of Incomplete Data in R.” Journal of Statistical Software 100 (20): 1–56. https://doi.org/10.18637/jss.v100.i20.

Tang, Y. 2018. “Controlled Pattern Imputation for Sensitivity Analysis of Longitudinal Binary and Ordinal Outcomes with Nonignorable Dropout.” Statistics in Medicine 37 (9): 1467–81. https://doi.org/10.1002/sim.7583.

Wang, T, and Liu, Y. 2022. “Remiod: Reference-Based Controlled Multiple Imputation of Longitudinal Binary and Ordinal Outcomes with Non-Ignorable Missingness.” arXiv 2203.02771. https://arxiv.org/pdf/2203.02771.

remiod's People

Contributors

xsswang avatar

Watchers

 avatar

remiod's Issues

Vignettes errors: Add 'markdown' to Suggests: to fix it

When running revdep checks on doFuture, I spotted your recent R-devel check errors;

Version: 1.0.1
Check: re-building of vignette outputs
Result: ERROR
    Error(s) in re-building vignettes:
     ...
    --- re-building 'ExampleBinary.md' using md
    Error: processing vignette 'ExampleBinary.md' failed with diagnostics:
    there is no package called 'markdown'
    --- failed re-building 'ExampleBinary.md'

Not sure if this is the reason for ffdb884#diff-29a78bd2d26c7f8f10e9c28be08b2e024c452cee66d79fd19771d70ce39ce678, but please note that the solution to the above R CMD check --as-cran errors on recent R-devel version is to add the markdown package to Suggests:.

Variable type of the treatment variable

Hello! I am using Remiod for my dissertation project. The data I have got has continuous outcomes with missing values, the aim is to model the data as MAR and MNAR (Delta, J2R and CR). When I include the treatment variable as numeric (coded as 0 for placebo and 1 for treatment), the algorithm works. However, when I include the treatment variable as factor (reference level 0 and treatment level 1), the algorithm said 'Error in MCMC_CR[, mc_imp_col_nam] <- predc : replacement has length zero' when J2R and CR were chosen and the trace plots of the parameters of the treatment variable did not work.

I can see that in the simple example of the 'schizow' data, 'tx' is coded as an integer. Is this an in-built requirement of the package such that categorical treatment variables are not allowed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.