Skip to content

Commit

Permalink
preparing for release
Browse files Browse the repository at this point in the history
  • Loading branch information
AnestisTouloumis committed Jul 25, 2019
1 parent 8f68085 commit 4c627e9
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 117 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: SimCorMultRes
Type: Package
Title: Simulates Correlated Multinomial Responses
Description: Simulates correlated multinomial responses conditional on a marginal model specification.
Version: 1.6.9
Version: 1.7.0
Depends: R(>= 2.15.0)
Imports:
evd,
Expand Down
3 changes: 2 additions & 1 deletion R/rbin.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
#' dep = sqrt(1 - 0.9),
#' model = "log", d = cluster_size
#' )
#' simulated_latent_variables <- simulated_latent_variables1 - simulated_latent_variables2 # nolintr
#' simulated_latent_variables <- simulated_latent_variables1 -
#' simulated_latent_variables2
#' simulated_binary_dataset <- rbin(
#' clsize = cluster_size,
#' intercepts = beta_intercepts, betas = beta_coefficients,
Expand Down
15 changes: 5 additions & 10 deletions R/rmult.acl.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,16 @@
#' xdata <- data.frame(x1, x2)
#' identity_matrix <- diag(4)
#' equicorrelation_matrix <- toeplitz(c(1, rep(0.95, cluster_size - 1)))
#' latent_correlation_matrix <- kronecker(
#' equicorrelation_matrix,
#' identity_matrix
#' )
#' simulated_ordinal_dataset <- rmult.acl(
#' clsize = cluster_size,
#' latent_correlation_matrix <- kronecker(equicorrelation_matrix,
#' identity_matrix)
#' simulated_ordinal_dataset <- rmult.acl(clsize = cluster_size,
#' intercepts = beta_intercepts, betas = beta_coefficients,
#' xformula = ~ x1 + x2, xdata = xdata,
#' cor.matrix = latent_correlation_matrix
#' )
#' cor.matrix = latent_correlation_matrix)
#' suppressPackageStartupMessages(library("multgee"))
#' ordinal_gee_model <- ordLORgee(y ~ x1 + x2,
#' data = simulated_ordinal_dataset$simdata, id = id, repeated = time,
#' LORstr = "time.exch", link = "acl"
#' )
#' LORstr = "time.exch", link = "acl")
#' round(coef(ordinal_gee_model), 2)
#' @export
rmult.acl <- function(clsize = clsize, intercepts = intercepts, betas = betas, # nolint
Expand Down
12 changes: 5 additions & 7 deletions R/rmult.bcl.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,15 @@
#' xdata <- data.frame(x1, x2)
#' equicorrelation_matrix <- toeplitz(c(1, rep(0.95, cluster_size - 1)))
#' identity_matrix <- diag(categories_no)
#' latent_correlation_matrix <- kronecker(equicorrelation_matrix, identity_matrix) # nolint
#' simulated_nominal_dataset <- rmult.bcl(
#' clsize = cluster_size,
#' latent_correlation_matrix <- kronecker(equicorrelation_matrix,
#' identity_matrix)
#' simulated_nominal_dataset <- rmult.bcl(clsize = cluster_size,
#' ncategories = categories_no, betas = betas, xformula = ~ x1 + x2,
#' xdata = xdata, cor.matrix = latent_correlation_matrix
#' )
#' xdata = xdata, cor.matrix = latent_correlation_matrix)
#' suppressPackageStartupMessages(library("multgee"))
#' nominal_gee_model <- nomLORgee(y ~ x1 + x2,
#' data = simulated_nominal_dataset$simdata, id = id, repeated = time,
#' LORstr = "time.exch"
#' )
#' LORstr = "time.exch")
#' round(coef(nominal_gee_model), 2)
#' @export
rmult.bcl <- function(clsize = clsize, ncategories = ncategories, betas = betas, # nolint
Expand Down
18 changes: 6 additions & 12 deletions R/rmult.clm.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,21 @@
#' beta_coefficients <- matrix(c(1, 2, 3, 4), 4, 1)
#' x <- rep(rnorm(sample_size), each = cluster_size)
#' latent_correlation_matrix <- toeplitz(c(1, 0.85, 0.5, 0.15))
#' simulated_ordinal_dataset <- rmult.clm(
#' clsize = cluster_size,
#' simulated_ordinal_dataset <- rmult.clm(clsize = cluster_size,
#' intercepts = beta_intercepts, betas = beta_coefficients, xformula = ~x,
#' cor.matrix = latent_correlation_matrix, link = "probit"
#' )
#' cor.matrix = latent_correlation_matrix, link = "probit")
#' head(simulated_ordinal_dataset$simdata, n = 8)
#'
#' ## Same sampling scheme except that the parameter vector is time-stationary.
#' set.seed(12345)
#' simulated_ordinal_dataset <- rmult.clm(
#' clsize = cluster_size, betas = 1,
#' simulated_ordinal_dataset <- rmult.clm(clsize = cluster_size, betas = 1,
#' xformula = ~x, cor.matrix = latent_correlation_matrix,
#' intercepts = beta_intercepts, link = "probit"
#' )
#' intercepts = beta_intercepts, link = "probit")
#' ## Fit a GEE model (Touloumis et al., 2013) to estimate the regression
#' ## coefficients.
#' library(multgee)
#' ordinal_gee_model <- ordLORgee(y ~ x,
#' id = id, repeated = time,
#' link = "probit", data = simulated_ordinal_dataset$simdata
#' )
#' ordinal_gee_model <- ordLORgee(y ~ x, id = id, repeated = time,
#' link = "probit", data = simulated_ordinal_dataset$simdata)
#' coef(ordinal_gee_model)
#' @export
rmult.clm <- function(clsize = clsize, intercepts = intercepts, betas = betas, # nolint
Expand Down
6 changes: 2 additions & 4 deletions R/rmult.crm.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@
#' ones_matrix <- matrix(1, cluster_size, cluster_size)
#' latent_correlation_matrix <- identity_matrix +
#' kronecker(equicorrelation_matrix, ones_matrix)
#' simulated_ordinal_dataset <- rmult.crm(
#' clsize = cluster_size,
#' simulated_ordinal_dataset <- rmult.crm(clsize = cluster_size,
#' intercepts = beta_intercepts, betas = beta_coefficients, xformula = ~x,
#' cor.matrix = latent_correlation_matrix, link = "probit"
#' )
#' cor.matrix = latent_correlation_matrix, link = "probit")
#' head(simulated_ordinal_dataset$Ysim)
#' @export
rmult.crm <- function(clsize = clsize, intercepts = intercepts, betas = betas, # nolint
Expand Down
33 changes: 12 additions & 21 deletions R/rnorta.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,35 @@
#' latent_correlation_matrix <- toeplitz(c(1, rep(0.8, 2)))
#' latent_correlation_matrix
#' common_marginal_distribution <- rep("qlogis", 3)
#' simulated_logistic_responses <- rnorta(
#' R = sample_size,
#' simulated_logistic_responses <- rnorta(R = sample_size,
#' cor.matrix = latent_correlation_matrix,
#' distr = common_marginal_distribution
#' )
#' distr = common_marginal_distribution)
#'
#' ## The following lines exemplify the NORTA method.
#' set.seed(1)
#' simulated_normal_responses <- rsmvnorm(
#' R = sample_size,
#' cor.matrix = latent_correlation_matrix
#' )
#' all(simulated_logistic_responses == qlogis(pnorm(simulated_normal_responses))) # nolintr
#' simulated_normal_responses <- rsmvnorm(R = sample_size,
#' cor.matrix = latent_correlation_matrix)
#' norta_simulated <- qlogis(pnorm(simulated_normal_responses))
#' all(simulated_logistic_responses == norta_simulated)
#'
#' ## Change the marginal distributions to standard normal, standard
#' ## logistic and standard extreme value distribution.
#' set.seed(1)
#' different_marginal_distributions <- c("qnorm", "qlogis", "qgumbel")
#' simulated_logistic_responses <- rnorta(
#' R = sample_size,
#' simulated_logistic_responses <- rnorta(R = sample_size,
#' cor.matrix = latent_correlation_matrix,
#' distr = different_marginal_distributions
#' )
#' distr = different_marginal_distributions)
#' cor(simulated_logistic_responses)
#' colMeans(simulated_logistic_responses)
#' apply(simulated_logistic_responses, 2, sd)
#'
#' ## Same as above but using parameter values other than the default ones.
#' set.seed(1)
#' qpars <- list(
#' c(mean = 1, sd = 9), c(location = 2, scale = 1),
#' c(loc = 3, scale = 1)
#' )
#' simulated_logistic_responses <- rnorta(
#' R = sample_size,
#' qpars <- list(c(mean = 1, sd = 9), c(location = 2, scale = 1),
#' c(loc = 3, scale = 1))
#' simulated_logistic_responses <- rnorta(R = sample_size,
#' cor.matrix = latent_correlation_matrix,
#' distr = different_marginal_distributions, qparameters = qpars
#' )
#' distr = different_marginal_distributions, qparameters = qpars)
#' cor(simulated_logistic_responses)
#' colMeans(simulated_logistic_responses)
#' apply(simulated_logistic_responses, 2, sd)
Expand Down
6 changes: 2 additions & 4 deletions R/rsmvnorm.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
#' set.seed(1)
#' sample_size <- 10000
#' correlation_matrix <- toeplitz(c(1, 0.4))
#' simulated_normal_responses <- rsmvnorm(
#' R = sample_size,
#' cor.matrix = correlation_matrix
#' )
#' simulated_normal_responses <- rsmvnorm(R = sample_size,
#' cor.matrix = correlation_matrix)
#' colMeans(simulated_normal_responses)
#' apply(simulated_normal_responses, 2, sd)
#' cor(simulated_normal_responses)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SimCorMultRes: Simulates Correlated Multinomial Responses

[![Github
version](https://img.shields.io/badge/GitHub%20-1.6.9-orange.svg)](%22commits/master%22)
version](https://img.shields.io/badge/GitHub%20-1.7.0-orange.svg)](%22commits/master%22)
[![Travis-CI Build
Status](https://travis-ci.org/AnestisTouloumis/SimCorMultRes.svg?branch=master)](https://travis-ci.org/AnestisTouloumis/SimCorMultRes)
[![Project Status: Active The project has reached a stable, usable state
Expand Down
3 changes: 3 additions & 0 deletions inst/NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Version 1.7.0 [2019-07-25]
* Reseased on CRAN.

Version 1.6.9 [2019-07-24]
* Cosmetic changes.

Expand Down
44 changes: 28 additions & 16 deletions man/rbin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions man/rmult.acl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions man/rmult.bcl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions man/rmult.clm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions man/rmult.crm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c627e9

Please sign in to comment.