diff --git a/README.Rmd b/README.Rmd index 9aeff22..1e47ef8 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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") ``` diff --git a/README.md b/README.md index 796f6f5..3cd8dfc 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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") diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 1ba201a..88dcc48 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -1,11 +1,12 @@ \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.} } } } @@ -13,13 +14,13 @@ \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.} } } } diff --git a/vignettes/SimCorMultRes.Rmd b/vignettes/SimCorMultRes.Rmd index 0146e53..ec3ae9f 100644 --- a/vignettes/SimCorMultRes.Rmd +++ b/vignettes/SimCorMultRes.Rmd @@ -15,7 +15,7 @@ biblio-style: "apalike" link-citations: true --- -```{r, echo = FALSE} +```{r echo = FALSE} knitr::opts_chunk$set( tidy = TRUE, collapse = TRUE, @@ -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]. @@ -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 @@ -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 @@ -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), @@ -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. @@ -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 @@ -473,7 +472,7 @@ apply(simulated_nominal_dataset$Ysim, 2, table) / sample_size # How to Cite -```{r, comment=""} +```{r comment=""} citation("SimCorMultRes") ``` diff --git a/vignettes/r_journal_paper.pdf.asis b/vignettes/r_journal_paper.pdf.asis index 705ca8c..d062586 100644 --- a/vignettes/r_journal_paper.pdf.asis +++ b/vignettes/r_journal_paper.pdf.asis @@ -1,4 +1,4 @@ -%\VignetteIndexEntry{Touloumis(2016) R journal paper} +%\VignetteIndexEntry{Touloumis (2016) - R journal paper} %\VignetteEngine{R.rsp::asis} %\VignetteKeyword{PDF} %\VignetteKeyword{HTML}