SimCorMultRes

Simulates correlated multinomial responses conditional on a marginal model specification.

https://github.com/anestistouloumis/simcormultres

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 2 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.5%) to scientific vocabulary

Keywords

binary longitudinal-studies multinomial r simulation
Last synced: 6 months ago · JSON representation

Repository

Simulates correlated multinomial responses conditional on a marginal model specification.

Basic Info
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 4
  • Open Issues: 1
  • Releases: 0
Topics
binary longitudinal-studies multinomial r simulation
Created over 8 years ago · Last pushed almost 2 years ago
Metadata Files
Readme

README.Rmd

---
output: github_document
references:
- id: Touloumis2016
  title: "Simulating Correlated Binary and Multinomial Responses under Marginal Model Specification: The SimCorMultRes Package"
  author:
  - family: Touloumis
    given: Anestis
  container-title: The R Journal
  volume: 8
  URL: 'https://journal.r-project.org/archive/2016/RJ-2016-034/index.html'
  issue: 2
  page: 79-91
  type: article-journal
  issued:
    year: 2016
csl: biometrics.csl    
---



```{r setup, include=FALSE}
knitr::opts_chunk$set(
  tidy = TRUE,
  tidy.opts = list(width.cutoff = 80),
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
```

# SimCorMultRes: Simulates Correlated Multinomial Responses

[![Github version](`r paste0("https://img.shields.io/badge/GitHub%20-", as.vector(read.dcf('DESCRIPTION')[, 'Version']),"-orange.svg")`)]("commits/master")
[![R-CMD-check](https://github.com/AnestisTouloumis/SimCorMultRes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/AnestisTouloumis/SimCorMultRes/actions/workflows/R-CMD-check.yaml)
[![Project Status: Active The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 
[![Codecov test coverage](https://codecov.io/gh/AnestisTouloumis/SimCorMultRes/branch/master/graph/badge.svg)](https://codecov.io/gh/AnestisTouloumis/SimCorMultRes?branch=master)

[![CRAN Version](https://www.r-pkg.org/badges/version/SimCorMultRes?color=blue)](https://cran.r-project.org/package=SimCorMultRes)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/SimCorMultRes?color=blue)](https://cranlogs.r-pkg.org/badges/grand-total/SimCorMultRes)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/SimCorMultRes)](https://cran.r-project.org/package=SimCorMultRes)


## Installation

You can install the release version of `SimCorMultRes`:

```{r eval=FALSE}
install.packages("SimCorMultRes")
```

The source code for the release version of `SimCorMultRes` is available on CRAN at:

- https://CRAN.R-project.org/package=SimCorMultRes

Or you can install the development version of `SimCorMultRes`:

```{r eval=FALSE}
# install.packages("devtools")
devtools::install_github("AnestisTouloumis/SimCorMultRes")
```

The source code for the development version of `SimCorMultRes` is available on github at:

- https://github.com/AnestisTouloumis/SimCorMultRes

To use `SimCorMultRes`, you should load the package as follows:

```{r}
library("SimCorMultRes")
```

## Usage and functions

This package provides five core functions to simulate correlated binary (`rbin`), nominal (`rmult.bcl`) and ordinal (`rmult.acl`, `rmult.clm` and `rmult.crm`) responses, which are drawn as realizations of a latent regression model for continuous random vectors as proposed by @Touloumis2016:

- `rbin` to simulate correlated binary responses under a marginal model with logit, probit, cloglog and cauchit link function,
- `rmult.bcl` to simulate correlated nominal multinomial responses under a marginal baseline-category logit model,
- `rmult.acl` to simulate correlated ordinal responses under a marginal adjacent-category logit model,
- `rmult.clm` to simulate correlated ordinal responses under a marginal cumulative link model,
- `rmult.crm` to simulate correlated ordinal responses under a marginal continuation-ratio link model.

All five functions, assume that you provide either the correlation matrix of the multivariate normal distribution in NORTA (via `cor.matrix`) or the values of the latent responses (via the `rlatent`). Based on a simulation study (see Section 3.5 of the vignette and dataset `simulation`), it is indicated that the correlation matrix of the multivariate normal distribution used in the NORTA method (via `cor.matrix`) can be considered a reliable approximation of the actual correlation matrix of the latent responses generated by the NORTA method. This appears to be the case irrespective of the marginal distributions of the latent responses for all the threshold approaches implemented in `SimCorMultRes`.

There are also two utility functions:

- `rnorta` for simulating continuous or discrete random vectors with prescribed marginal distributions using the NORTA method,
- `rsmvnorm` for simulating continuous random vectors from a multivariate normal distribution.


## Example

The following R code illustrates how to use the core function `rbin`:

```{r}
## See Example 3.5 in the Vignette.
set.seed(123)
## define number of random vectors
sample_size <- 100
## define size of each random vector
cluster_size <- 4
## define intercept of the binary probit regression model
beta_intercepts <- 0
## define coefficients of the explanatory variables
beta_coefficients <- 0.2
## provide explanatory variables
x <- rep(rnorm(sample_size), each = cluster_size)
## define correlation matrix for the multivariate normal distribution in NORTA
latent_correlation_matrix <- toeplitz(c(1, 0.9, 0.9, 0.9))
## use rbin function to create the desired dataset
simulated_binary_responses <- rbin(clsize = cluster_size,
                                   intercepts = beta_intercepts,
                                   betas = beta_coefficients, 
                                   xformula = ~  x,
                                   cor.matrix = latent_correlation_matrix,
                                   link = "probit")
library("gee")
binary_gee_model <- gee(y ~ x, family = binomial("probit"), id = id,
                        data = simulated_binary_responses$simdata)
summary(binary_gee_model)$coefficients
```

Additional examples can be found in @Touloumis2016 and in the vignette of `SimCorMultRes`. To access these two documents, run the following command:

```{r eval=FALSE}
browseVignettes("SimCorMultRes")
```

## How to cite

```{r echo=FALSE, comment=""}
citation("SimCorMultRes")
```

# References

Owner

  • Name: Anestis Touloumis
  • Login: AnestisTouloumis
  • Kind: user
  • Location: Brighton, UK
  • Company: University of Brighton

GitHub Events

Total
Last Year

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 90
  • Total Committers: 2
  • Avg Commits per committer: 45.0
  • Development Distribution Score (DDS): 0.067
Past Year
  • Commits: 8
  • Committers: 1
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
AnestisTouloumis A****s@b****k 84
Anestis Touloumis a****9@b****k 6
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 0
  • Average time to close issues: 11 days
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 1.33
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Sandy4321 (2)
  • ayamitani (1)
Pull Request Authors
Top Labels
Issue Labels
invalid (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 379 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 2
  • Total versions: 13
  • Total maintainers: 1
cran.r-project.org: SimCorMultRes

Simulates Correlated Multinomial Responses

  • Versions: 13
  • Dependent Packages: 1
  • Dependent Repositories: 2
  • Downloads: 379 Last month
Rankings
Forks count: 12.2%
Dependent packages count: 18.1%
Dependent repos count: 19.2%
Stargazers count: 19.3%
Average: 20.8%
Downloads: 35.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.15.0 depends
  • evd * imports
  • methods * imports
  • stats * imports
  • bookdown * suggests
  • covr * suggests
  • gee * suggests
  • knitr * suggests
  • multgee >= 1.2 suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite