Skip to content

Commit

Permalink
220915: minor updates/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AnestisTouloumis committed Sep 15, 2022
1 parent c4fb72d commit e1a1784
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,21 @@ simulated_binary_responses <- rbin(clsize = cluster_size,
betas = beta_coefficients, xformula = ~ x,
cor.matrix = latent_correlation_matrix,
link = "probit")
library(gee)
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`.
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}
```{r eval=FALSE}
browseVignettes("SimCorMultRes")
```

## How to cite

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

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ latent_correlation_matrix <- toeplitz(c(1, 0.9, 0.9, 0.9))
simulated_binary_responses <- rbin(clsize = cluster_size, intercepts = beta_intercepts,
betas = beta_coefficients, xformula = ~x, cor.matrix = latent_correlation_matrix,
link = "probit")
library(gee)
library("gee")
binary_gee_model <- gee(y ~ x, family = binomial("probit"), id = id, data = simulated_binary_responses$simdata)
#> Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
#> running glm to get initial regression estimate
Expand All @@ -116,7 +116,8 @@ summary(binary_gee_model)$coefficients
```

Additional examples can be found in Touloumis (2016) and in the vignette
of `SimCorMultRes`.
of `SimCorMultRes`. To access these two documents, run the following
command:

``` r
browseVignettes("SimCorMultRes")
Expand Down
9 changes: 5 additions & 4 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
\name{NEWS}
\title{NEWS file for the \pkg{SimCorMultRes} package}

\section{Changes in Version 1.8.1 (2022-09-13)}{
\section{Changes in Version 1.8.1 (2022-09-15)}{
\subsection{MINOR CHANGES}{
\itemize{
\item{Improved README.}
\item{Added R journal paper as vignette.}
\item{Improved README.}
\item{Improved vignette.}
}
}
}

\section{Changes in Version 1.8.0 (2021-06-10)}{
\subsection{MINOR CHANGES}{
\itemize{
\item{Corrected naming of variables in formula.}
\item{Added \code{identity} link in \code{rbin}.}
\item{Added \pkg{rmarkdown} dependency.}
\item{Corrected naming of variables in formula.}
\item{Removed \pkg{markdown} dependency.}
\item{Migrating from travis-ci to github actions.}
\item{Created NEWS.Rd.}
\item{Fixed ORCID in DESCRIPTION.}
\item{Migrating from travis-ci to github actions.}
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions vignettes/SimCorMultRes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ biblio-style: "apalike"
link-citations: true
---

```{r, echo = FALSE}
```{r echo = FALSE}
knitr::opts_chunk$set(
tidy = TRUE,
collapse = TRUE,
Expand All @@ -24,7 +24,7 @@ knitr::opts_chunk$set(
```

# Introduction
The R package `SimCorMultRes` is suitable for simulation of correlated binary responses (exactly two response categories) and of correlated nominal or ordinal multinomial responses (three or more response categories) conditional on a regression model specification for the marginal probabilities of the response categories. This vignette briefly describes the simulation methods proposed by @Touloumis2016 and illustrates the use of the core functions of `SimCorMultRes`. A more detailed description of `SimCorMultRes` can be found in @Touloumis2016.
The R package `SimCorMultRes` is suitable for simulation of correlated binary responses (exactly two response categories) and of correlated nominal or ordinal multinomial responses (three or more response categories) conditional on a regression model specification for the marginal probabilities of the response categories. A more detailed description of `SimCorMultRes` can be found in @Touloumis2016. This vignette briefly describes the simulation methods proposed by @Touloumis2016, introduces how to simulate ordinal responses under a marginal adjacent-category logit model and illustrates the use of the core functions of `SimCorMultRes`.

# Areas of Applications
This package was created to facilitate the task of carrying out simulation studies and evaluating the performance of statistical methods for estimating the regression parameters in a marginal model with clustered binary and multinomial responses. Examples of such statistical methods include maximum likelihood methods, copula approaches, quasi-least squares approaches, generalized quasi-likelihood methods and generalized estimating equations (GEE) approaches among others [see references in @Touloumis2016].
Expand Down Expand Up @@ -68,7 +68,7 @@ where $N=500$, $T=3$, $(\beta_{10},\beta_{11},\beta_{12},\beta_{20},\beta_{21},\
for all $i=1,\ldots,500$.
```

```{r, tidy=TRUE}
```{r}
# parameter vector
betas <- c(1, 3, 2, 1.25, 3.25, 1.75, 0.75, 2.75, 2.25, 0, 0, 0)
# sample size
Expand Down Expand Up @@ -264,7 +264,7 @@ where $N=500$, $T=3$, $(\beta_{10},\beta_{20},\beta_{30})=(3, 2, 1)$, $(\beta_{1
for all $i=1,\ldots,500$.
```

```{r, tidy=TRUE}
```{r}
# intercepts
beta_intercepts <- c(3, 2, 1)
# parameter vector
Expand Down Expand Up @@ -381,7 +381,7 @@ It follows that $e_{it}^{B}\sim F$ for all $i$ and $t$ and $\textrm{corr}(\mathb
```{r}
set.seed(8)
# simulation of epsilon variables
library(evd)
library("evd")
simulated_latent_variables1 <- rmvevd(sample_size, dep = sqrt(1 - 0.9),
model = "log", d = cluster_size)
simulated_latent_variables2 <- rmvevd(sample_size, dep = sqrt(1 - 0.9),
Expand Down Expand Up @@ -413,7 +413,6 @@ To achieve simulation of clustered binary, ordinal and nominal responses under n

5. Run the core function to obtain realizations of the simulated clustered responses.

\textbf{ }

```{example, label=no-covariate, name="Simulation of clustered binary responses without covariates"}
Suppose the goal is to simulate $5000$ clustered binary responses with $\Pr(Y_{t}=1)=0.8$ for all $t=1,\ldots,4$. For simplicity, assume that the clustered binary responses are independent.
Expand Down Expand Up @@ -448,7 +447,7 @@ Suppose the aim is to simulate $N=5000$ clustered nominal responses with
$\Pr(Y_{t}=1)=0.1$, $\Pr(Y_{t}=2)=0.2$, $\Pr(Y_{t}=3)=0.3$ and $\Pr(Y_{t}=4)=0.4$, for all $i$ and $t=1,\ldots,3$. For the sake of simplicity, we assume that the clustered responses are independent.
```

```{r, tidy=TRUE}
```{r}
# sample size
sample_size <- 5000
# cluster size
Expand All @@ -473,7 +472,7 @@ apply(simulated_nominal_dataset$Ysim, 2, table) / sample_size


# How to Cite
```{r, comment=""}
```{r comment=""}
citation("SimCorMultRes")
```

Expand Down
2 changes: 1 addition & 1 deletion vignettes/r_journal_paper.pdf.asis
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%\VignetteIndexEntry{Touloumis(2016) R journal paper}
%\VignetteIndexEntry{Touloumis (2016) - R journal paper}
%\VignetteEngine{R.rsp::asis}
%\VignetteKeyword{PDF}
%\VignetteKeyword{HTML}
Expand Down

0 comments on commit e1a1784

Please sign in to comment.