Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Md S. Warasi authored and cran-robot committed Nov 22, 2021
0 parents commit a87ab33
Show file tree
Hide file tree
Showing 17 changed files with 2,720 additions and 0 deletions.
16 changes: 16 additions & 0 deletions DESCRIPTION
@@ -0,0 +1,16 @@
Package: groupTesting
Title: Simulating and Modeling Group (Pooled) Testing Data
Version: 1.0.0
Date: 2021-11-19
Author: Md S. Warasi
Maintainer: Md S. Warasi <msarker@radford.edu>
Description: Provides an expectation-maximization (EM) algorithm using the approach introduced in Xie (2001) <doi:10.1002/sim.817>. The EM algorithm can be used to estimate the prevalence (overall proportion) of a disease and to estimate a binary regression model from among the class of generalized linear models based on group testing data. The estimation framework we consider offers a flexible and general approach; i.e., its application is not limited to any specific group testing protocol. Consequently, the EM algorithm can model data arising from simple pooling as well as advanced pooling such as hierarchical testing, array testing, and quality control pooling. Also, provided are functions that can be used to conduct the Wald tests described in Buse (1982) <doi:10.1080/00031305.1982.10482817> and to simulate the group testing data described in Kim et al. (2007) <doi:10.1111/j.1541-0420.2007.00817.x>.
License: GPL-3
Depends: R(>= 3.5.0)
Imports: pracma
NeedsCompilation: yes
Encoding: UTF-8
RoxygenNote: 7.1.1
Packaged: 2021-11-19 18:49:25 UTC; msarker
Repository: CRAN
Date/Publication: 2021-11-22 09:00:02 UTC
16 changes: 16 additions & 0 deletions MD5
@@ -0,0 +1,16 @@
2d2e7f5417633fc3e05179f24ce12867 *DESCRIPTION
19e4497639be28ffc4dc737e66e5e2d7 *NAMESPACE
67e9f5c036f34456c44ea590b83e93b2 *R/gtcode.R
e7110e7f48030f35698eb91d91a4e528 *R/linkfns.R
a449c57bfef435657267f231eba233ca *R/propEM.R
b6523d7dfb32c95639cced2d36b2c0fc *R/regEM.R
c0f4895459d8677dec2f2ad4600141f0 *R/waldTest.R
e30b5e61eb92e83201c46850741bfaec *man/array.gt.simulation.Rd
153f56fbddfd60e6bf7ac2fdd424b0c5 *man/glm.gt.Rd
005753654cb1ba175c4a66d57e5d166e *man/glmLink.Rd
98cd54c4cb84265e55b4bb7c982cf39e *man/hier.gt.simulation.Rd
2140f47f6eaa073f0b042aad9ed5da82 *man/prop.gt.Rd
148ef1e8336716c9208b7e77ad53fbef *man/waldTest.Rd
9b11ec0e9f983e39a5cf915d5002dc6f *src/Makevars.txt
cb44d44d2eb4d6b7ffd7d32607f5968e *src/gtestingc.c
1f0efc225a8218d7aad4216e8597ab7a *src/gtestingf.f95
16 changes: 16 additions & 0 deletions NAMESPACE
@@ -0,0 +1,16 @@
# Generated by roxygen2: do not edit by hand

export(array.gt.simulation)
export(glm.gt)
export(glmLink)
export(hier.gt.simulation)
export(prop.gt)
export(waldTest)
importFrom(pracma,fderiv)
importFrom(stats,optim)
importFrom(stats,pchisq)
importFrom(stats,pnorm)
importFrom(stats,qnorm)
importFrom(stats,rbinom)
importFrom(stats,runif)
useDynLib(groupTesting, .registration=TRUE)
456 changes: 456 additions & 0 deletions R/gtcode.R

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions R/linkfns.R
@@ -0,0 +1,50 @@
#' Link Functions in the Class of Generalized Linear Models
#'
#' This function provides characteristics of common link functions (logit, probit, and comlementary log-log). Specifically, based on the link name, the function with its inverse, first derivative, and second derivative is provided.
#'
#' @param fn.name One of the three: "logit", "probit", and "cloglog".
#'
#' @importFrom stats pnorm
#' @importFrom stats qnorm
#'
#' @return A list with components:
#' \item{g}{The link function corresponding to "logit", "probit", or "cloglog".}
#' \item{dg}{The first derivative of g.}
#' \item{d2g}{The second derivative of g.}
#' \item{gInv}{The inverse of g.}
#'
#' @export
#'
#' @examples
#' ## Try:
#' glmLink("logit")
#'
glmLink <- function(fn.name=c("logit","probit","cloglog")){
fn.name <- match.arg(fn.name)

# Logit link
if(fn.name == "logit"){
g <- function(u){exp(u)/(1+exp(u))}
dg <- function(u){exp(u)/(1+exp(u))^2}
d2g <- function(u){exp(u)*(1-exp(u))/(1+exp(u))^3}
g.inv <- function(u){log(u/(1-u))}
}
# Probit link
if(fn.name == "probit"){
g <- function(u){stats::pnorm(u)}
dg <- function(u){exp(-u^2/2)/sqrt(2*pi)}
d2g <- function(u){-u*exp(-u^2/2)/sqrt(2*pi)}
g.inv <- function(u){stats::qnorm(u)}
}
# Complementary log-log link
if(fn.name == "cloglog"){
g <- function(u){1 - exp(-exp(u))}
dg <- function(u){exp(u)*exp(-exp(u))}
d2g <- function(u){exp(u)*exp(-exp(u))*(1-exp(u))}
g.inv <- function(u){log(-log(1-u))}
}
list("g" = g,
"dg" = dg,
"d2g" = d2g,
"gInv"= g.inv)
}

0 comments on commit a87ab33

Please sign in to comment.