[med-svn] [r-cran-epitools] 06/08: New upstream version 0.5-9

Andreas Tille tille at debian.org
Mon Oct 9 15:45:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-epitools.

commit 9de2c03c362e14507c4b69526398bedf3bb71c98
Author: Andreas Tille <tille at debian.org>
Date:   Mon Oct 9 19:44:12 2017 +0200

    New upstream version 0.5-9
---
 DESCRIPTION               |  30 ++++++------
 MD5                       |  62 +++++++++++++------------
 NAMESPACE                 |   8 ++++
 R/probratio.r             | 113 ++++++++++++++++++++++++++++++++++++++++++++++
 R/riskratio.boot.R        |   4 +-
 man/ageadjust.direct.Rd   |   4 +-
 man/ageadjust.indirect.Rd |   4 +-
 man/as.hour.Rd            |   4 +-
 man/as.month.Rd           |   4 +-
 man/as.week.Rd            |   4 +-
 man/binom.conf.int.Rd     |   6 +--
 man/colorbrewer.Rd        |   4 +-
 man/colors.plot.Rd        |   4 +-
 man/epicurve.Rd           |   4 +-
 man/epidate.Rd            |   4 +-
 man/epitab.Rd             |   4 +-
 man/epitable.Rd           |   4 +-
 man/expand.table.Rd       |   4 +-
 man/expected.Rd           |   4 +-
 man/julian2date.Rd        |   4 +-
 man/kapmeier.Rd           |   4 +-
 man/oddsratio.Rd          |   4 +-
 man/or.midp.Rd            |   4 +-
 man/ormidp.test.Rd        |   4 +-
 man/oswego.Rd             |   2 +-
 man/pois.conf.int.Rd      |   6 +--
 man/probratio.Rd          |  78 ++++++++++++++++++++++++++++++++
 man/rate2by2.test.Rd      |   4 +-
 man/rateratio.Rd          |   4 +-
 man/ratetable.Rd          |   4 +-
 man/riskratio.Rd          |   4 +-
 man/tab2by2.test.Rd       |   4 +-
 man/table.margins.Rd      |   4 +-
 33 files changed, 303 insertions(+), 102 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index f19911e..6e1bdea 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,19 +1,21 @@
 Package: epitools
-Version: 0.5-7
-Date: 2012-09-30
+Version: 0.5-9
+Date: 2017-04-13
 Title: Epidemiology Tools
-Authors at R: c(person("Tomas J. Aragon", "Developer", role = c("aut",
-        "cre"), email = "aragon at berkeley.edu"), person("Michael P.
-        Fay", "User", role = "ctb", email = "mfay at niaid.nih.gov"),
-        person("Daniel Wollschlaeger", "User", role = "ctb", email =
-        "dwoll at psychologie.uni-kiel.de"))
+Authors at R: c(person("Tomas J.", "Aragon", role = "aut",
+        email = "aragon at berkeley.edu"), person("Michael P.",
+        "Fay", role = "ctb", email = "mfay at niaid.nih.gov"),
+        person("Daniel", "Wollschlaeger", role = "ctb", email =
+        "dwoll at psychologie.uni-kiel.de"),
+        person("Adam", "Omidpanah", role = c("cre", "ctb"), email =
+        "adam.omidpanah at wsu.edu"))
 Depends: R (>= 2.1.0)
-Description: EpiTools: R Package for Epidemiologic Data and Graphics
+Description: Tools for training and practicing epidemiologists including methods for two-way and multi-way contingency tables.
 License: GPL (>= 2)
-URL: http://medepi.com/epitools/
-Packaged: 2012-09-30 09:01:55 UTC; tja
-Author: Tomas J. Aragon Developer [aut, cre], Michael P. Fay User
-        [ctb], Daniel Wollschlaeger User [ctb]
-Maintainer: Tomas J. Aragon Developer <aragon at berkeley.edu>
+Packaged: 2017-04-14 17:48:42 UTC; adam.omidpanah
+Author: Tomas J. Aragon [aut], Michael P. Fay
+        [ctb], Daniel Wollschlaeger [ctb], Adam Omidpanah [cre, ctb]
+Maintainer: Adam Omidpanah <adam.omidpanah at wsu.edu>
 Repository: CRAN
-Date/Publication: 2012-09-30 09:29:17
+Date/Publication: 2017-04-14 23:04:36 UTC
+NeedsCompilation: no
diff --git a/MD5 b/MD5
index aa47f95..e5ee0f4 100644
--- a/MD5
+++ b/MD5
@@ -1,5 +1,5 @@
-3587d09cf96a02eb676b8e4e35c9a634 *DESCRIPTION
-787a3926ee8dc9d4a58474fda920e746 *NAMESPACE
+abef416cd1c730e7137263f9b1791b4a *DESCRIPTION
+f259c9f26e82e13a8eb777c4f2fbecc7 *NAMESPACE
 2745fc0b8c7dd39e9272b0a8d8d573ae *R/ageadjust.direct.R
 f57b81c6d42888d11c7673aa911aaaa4 *R/ageadjust.indirect.R
 9999f1f5ee9c394bf1a34add54477f64 *R/as.hour.R
@@ -36,13 +36,14 @@ e28acb2889bafdd602f505928ac631af *R/pois.approx.R
 b4af057b9684dd25a204d0fdd07bc490 *R/pois.byar.R
 92a9a8539406cf2b7891d3c620948f02 *R/pois.daly.R
 6f7f8d32c5b17250ab5114fa0eb90ef4 *R/pois.exact.R
+f55b48d7e8d39764eacac14d02617368 *R/probratio.r
 d963dd2d0fd72e1b1852100d3f3a731c *R/rate2by2.test.R
 23a6d06d89f020f2632c8167a1c5bfb6 *R/rateratio.R
 a3353788495494cfe1701acf61e1296b *R/rateratio.midp.R
 b5a48d34e42c464993cdc31d6f2450af *R/rateratio.wald.R
 da5914dac422077e09bf4ec11bd0bdcb *R/ratetable.R
 7d63605703662d7f708b79875995fafb *R/riskratio.R
-125a035ac52a4b51c83231c6621668a3 *R/riskratio.boot.R
+5482920348d27e7b2b0e2f44fe908b02 *R/riskratio.boot.R
 c6786e9f1bec78093f3c8bf3127b990f *R/riskratio.small.R
 372dc792ac711f77388e2351cd8529f6 *R/riskratio.wald.R
 05e1e91775de4db5b6c40e5064d471a1 *R/tab2by2.test.R
@@ -50,32 +51,33 @@ d7e398c713b9e03c7f24d0d5178749f6 *R/table.margins.R
 599db95edbab735f585432c50c915e8f *data/oswego.rda
 4bc99d86c08e5e31f6e87132281c6354 *data/wcgs.rda
 f7ca7daa6bea1cfa48fe3278634836e9 *data/wnv.rda
-ef10a1d1ba0896c3adb4a3c7be4a0547 *man/ageadjust.direct.Rd
-7339dab6557573a737f5fed7de57b60e *man/ageadjust.indirect.Rd
-579531d0b703c5558ea1cffae831f700 *man/as.hour.Rd
-e9ad660cdf6d1c31717827d68d4b7caa *man/as.month.Rd
-62d84b4b0189396262db2d2c800166e5 *man/as.week.Rd
-1b84a495804481aef6bee15877399225 *man/binom.conf.int.Rd
-5be14416afb7bf79277c72481ae8426b *man/colorbrewer.Rd
-940fa9513363101bc89c2e83abcf5185 *man/colors.plot.Rd
-e37acacabd3503a59bc283e7be9196d2 *man/epicurve.Rd
-b9514b5241c24fefbd3cf48a98342b35 *man/epidate.Rd
-552b2f8c9ce566d1c8fdf62457edfdec *man/epitab.Rd
-2f3aaecfe04d438e6dedec245e7ec47c *man/epitable.Rd
-90032b4b49df3d2f3275833bff9d9732 *man/expand.table.Rd
-6a92e8e58bcc7a03c9c85eff97c35896 *man/expected.Rd
-4ee02d307a62c7e996997a162bfd876c *man/julian2date.Rd
-ecff5fdd5e71b3babc636b3ac7850cc0 *man/kapmeier.Rd
-ee9bebfdbb9ae27667ae0dd21c43fe10 *man/oddsratio.Rd
-7dabc5455b8e1c0f6b3b007b35715218 *man/or.midp.Rd
-475a2ef1a59124deeff4c0bf53e90622 *man/ormidp.test.Rd
-8632ed1d6d8ad1442dd9666367c5b26f *man/oswego.Rd
-241f0c2746844aed780423378966dcf3 *man/pois.conf.int.Rd
-0511f0758af051db6fa8ccb5f2185064 *man/rate2by2.test.Rd
-3aa0827869ab7a123e4e948e5871ca43 *man/rateratio.Rd
-f7dc5995437c96381be0509fbd715d55 *man/ratetable.Rd
-6e53fae004ce10ce318b15929dccbd56 *man/riskratio.Rd
-81dcc99e5aae440f635e614fe13cc445 *man/tab2by2.test.Rd
-fd25010547285fb0406ebdbd20c9dc63 *man/table.margins.Rd
+2ecd6774c3f523c83284892ad1fd6bca *man/ageadjust.direct.Rd
+d41e7c97f6fe25f55bb36bcf745411fd *man/ageadjust.indirect.Rd
+4651e245cf53e65b2d7a3409b80fdc28 *man/as.hour.Rd
+828563827b1cc26d6ba1e9ddb85ca321 *man/as.month.Rd
+bbc8be41dc8edffcac753bf5e9550c8e *man/as.week.Rd
+e4c54b3e4ad98db993e292c289e0c5e2 *man/binom.conf.int.Rd
+03dc3e297ee6a20a59bd82584ad7981e *man/colorbrewer.Rd
+2ba04a295ec5be831bc257728f4c1b40 *man/colors.plot.Rd
+8b2ba43ece30ab1813482df74d2fd524 *man/epicurve.Rd
+ccefe1c4ad859cdc5f424432205646aa *man/epidate.Rd
+60fdf552393e0d5826ef8a0c6c5d975c *man/epitab.Rd
+f1578bc60e2b81620e66d05a1b4ab050 *man/epitable.Rd
+5c6fcb8ae2da13dbc3262550652b42e9 *man/expand.table.Rd
+505f1a901450169ac054b6ee3c690239 *man/expected.Rd
+15f06c30128f8556685bf4b65c083ae1 *man/julian2date.Rd
+518a7ea26bd0cd1469797dfa88885440 *man/kapmeier.Rd
+50808280b2ab493fbf40ac08c8063597 *man/oddsratio.Rd
+f6aea5940cd50004b1cb1891932c26e0 *man/or.midp.Rd
+cc44f5cbf9bf742da3fc2812fbb0116d *man/ormidp.test.Rd
+60c145e9a59b01973ad1ef5d354e9eda *man/oswego.Rd
+7e4aadfb1419d6707259d2dfbced4ba2 *man/pois.conf.int.Rd
+87bb14cc9f0590b20b9885172e7e8e1a *man/probratio.Rd
+7a6a6a89eda18545c4194f62827dc7b9 *man/rate2by2.test.Rd
+065d02278f69456c17b29793d3273956 *man/rateratio.Rd
+76d5efb56197e4496efe1e8d14b803bf *man/ratetable.Rd
+2ee62232595ea0e0ca866ef586e8a09d *man/riskratio.Rd
+5bda8bae7c61e9fbb874d64d247bcff6 *man/tab2by2.test.Rd
+649f7061356cd0ae69410c6dc7022e48 *man/table.margins.Rd
 6eee4357e4f5efd6ac15912e8c6cbea8 *man/wcgs.Rd
 b9f7bf52cb42a1a9edb8a505f21f2bc5 *man/wnv.Rd
diff --git a/NAMESPACE b/NAMESPACE
index 6b1f9a3..34c265a 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1 +1,9 @@
 exportPattern("^[^\\.]")
+importFrom("grDevices", "colors", "rgb")
+importFrom("graphics", "abline", "axis", "barplot", "matplot",
+            "points", "rect", "text", "title")
+importFrom("stats", "binom.test", "chisq.test", "dbinom", "dpois",
+            "fisher.test", "ftable", "pbinom", "pchisq", "pnorm",
+            "ppois", "qgamma", "qnorm", "quantile", "rbinom", "uniroot",
+           'confint.default', "binomial", "coef", "deriv", "family", "glm",
+             "glm.fit", "model.matrix", "sd", "vcov")
\ No newline at end of file
diff --git a/R/probratio.r b/R/probratio.r
new file mode 100644
index 0000000..75af8be
--- /dev/null
+++ b/R/probratio.r
@@ -0,0 +1,113 @@
+probratio <- function(object, parm, subset, method=c('ML', 'delta', 'bootstrap'), scale=c('linear', 'log'), level=0.95, 
+                    seed, NREPS=100, ...) {
+  if (length(match('glm', class(object))) < 0) 
+    stop('Non GLM input to "object"')
+  if (family(object)$family != 'binomial')
+    stop('object not a logistic regression model')
+  nc <- length(cf <- coef(object))
+  if (missing(subset))
+    subset <- T
+  if (missing(parm))
+    parm <- seq(2, nc)
+  cf <- cf[parm]
+  
+  method <- match.arg(method, c('ML', 'delta', 'bootstrap'))
+  
+  scale <- match.arg(scale, c('linear', 'log'))
+  if (is.na(scale))
+    stop('scale cannot take values outside of linear or log')
+  if (scale == 'linear') {
+    f <- function(x) x[2]/x[1]
+    name <- c('Relative risk')
+    null <- 1
+  } else {
+    name <- c('Log relative risk')
+    null <- 0
+    f <- function(x)log(x[2]) - log(x[1])
+  }
+  cilevel <- c({1-level}/2, 1-{1-level}/2)
+  ciname <- paste0(c('Lower', 'Upper'), ' ', formatC(100*cilevel, format='f', digits=1), '% CI')
+    
+  if (method == 'ML') {
+    newfit <- glm(object, family=binomial(link=log), subset=subset, ...)
+    out <- coef(summary(newfit))[parm, , drop=F]
+    
+    if (scale == 'log') {
+      out <- cbind(out[, 1], out[, 2], out[, 3], out[, 4], out[, 1] + qnorm((1-level)/2)*out[, 2], out[, 1] + qnorm(1-(1-level)/2)*out[, 2])
+    } else {
+      val <- exp(out[, 1])
+      se <- val * out[, 2]
+      out <- cbind(val, se, z <- abs(val-1)/se, pnorm(z, lower.tail = F)*2, 
+                   val + qnorm((1-level)/2)*se, val + qnorm(1-(1-level)/2)*se)
+    }
+    colnames(out) <- c(name, 'Std. Error', 'Z-value', 'p-value', ciname)
+    return(out)
+  }
+  
+  Mod1 <- Mod0 <- model.matrix(object)[subset, ]
+  n <- nrow(Mod0)
+  Nvec <- matrix(rep(c(1/n,0,0,1/n),each=n), n*2, 2)
+    
+  if (method == 'delta') {
+    if (scale == 'linear') {
+      df <- deriv( ~y/x, c('x', 'y'))
+    } else {
+      df <- deriv(~log(y) - log(x), c('x', 'y'))
+    }
+    
+    out <- sapply(parm, function(p) {
+      Mod0[, p] <- 0
+      Mod1[, p] <- 1
+      Mod <- rbind(Mod0, Mod1)
+      allpreds <- family(object)$linkinv(Mod %*% coef(object))
+      avgpreds <- t(Nvec)%*% allpreds
+      val <- f(avgpreds)
+      V <- sweep(chol(vcov(object)) %*% t(Mod), allpreds*(1-allpreds), '*', MARGIN = 2) %*% Nvec
+      V <- t(V)%*%V
+      dxdy <- matrix(attr(eval(df, list('x'=avgpreds[1], 'y'=avgpreds[2])), 'gradient'))
+      se <- sqrt(t(dxdy)%*%V%*%dxdy)
+      out <- c(val, se, z <- abs({val-null}/se), pnorm(z, lower.tail=F)*2, val + qnorm(cilevel[1])*se, val + qnorm(cilevel[2])*se)
+      names(out) <- c(name, 'Std. Error', 'Z-value', 'p-value', ciname)
+      out
+    })
+    out <- t(out)
+    rownames(out) <- names(cf)
+    return(out)
+  } ## endif delta
+  
+  if (method == 'bootstrap') {
+    if (missing(seed))
+      stop('seed must be supplied by the user when obtaining results from random number generation')
+    set.seed(seed)
+    out <- replicate(NREPS, {
+      
+      index <- sample(1:n, n, replace=T)
+      Mod <- model.matrix(object)[subset, ][index, ]
+      newbeta <- glm.fit(Mod, object$y[index], family=binomial())$coef
+      out <- sapply(parm, function(p) {
+        Mod1 <- Mod0 <- Mod
+        Mod1[, p] <- 1
+        Mod0[, p] <- 0
+        Mod <- rbind(Mod0, Mod1)
+        newpreds <- family(object)$linkinv(Mod %*% newbeta)
+        f(t(Nvec) %*% newpreds)
+      })
+      out
+    })
+    
+    
+    if (length(parm) == 1) {
+    out <- c(val <- mean(out), se <- sd(out), z <- abs({val - null}/se), pnorm(z, lower.tail = F)*2,
+             val + qnorm((1-level)/2)*se, val + qnorm(1-(1-level)/2)*se)
+    names(out) <- c(name, 'Std. Error', 'Z-value', 'p-value', ciname)
+    } else {
+      out <- cbind(val <- rowMeans(out), se <- apply(out, 1, sd), z <- abs({val - null}/se), pnorm(z, lower.tail = F)*2,
+                   val + qnorm(cilevel[1])*se, val + qnorm(cilevel[2])*se)
+      colnames(out) <- c(name, 'Std. Error', 'Z-value', 'p-value', ciname)  
+      rownames(out) <- names(cf)
+    }
+    
+    return(out)
+  }
+}
+
diff --git a/R/riskratio.boot.R b/R/riskratio.boot.R
index 8a0f825..91bc076 100644
--- a/R/riskratio.boot.R
+++ b/R/riskratio.boot.R
@@ -27,8 +27,8 @@ function(x, y = NULL,
       r1 <- rbinom(replicates, n1, p1)/n1
       r0 <- rbinom(replicates, n0, p0)/n0
       rrboot <- r1/r0
-      rrbar <- mean(rrboot)
-      ci <- quantile(rrboot, c(alpha/2, 1-alpha/2))
+      rrbar <- mean(rrboot, na.rm=T)
+      ci <- quantile(rrboot, c(alpha/2, 1-alpha/2), na.rm = T)
       list(p0 = p0, p1 = p1, rr = p1/p0, rr.mean = rrbar,
            conf.level = conf.level, conf.int = unname(ci),
            replicates = replicates)
diff --git a/man/ageadjust.direct.Rd b/man/ageadjust.direct.Rd
index 4d96abd..6d12d70 100644
--- a/man/ageadjust.direct.Rd
+++ b/man/ageadjust.direct.Rd
@@ -62,9 +62,9 @@ ageadjust.direct(count, pop, rate = NULL, stdpop, conf.level = 0.95)
 }
 
 \author{Michael P. Fay, \email{mfay at niaid.nih.gov}; Tomas Aragon,
-  \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+  \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/ageadjust.indirect.Rd b/man/ageadjust.indirect.Rd
index e38b470..3ddd69e 100644
--- a/man/ageadjust.indirect.Rd
+++ b/man/ageadjust.indirect.Rd
@@ -56,11 +56,11 @@ conf.level = 0.95)
 }
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}. Thanks to Giles Crane
+  \url{http://www.phdata.science}. Thanks to Giles Crane
   (\email{giles.crane at doh.state.nj.us}) for reporting error in
   'ageadjust.indirect' function.}
 
-\note{Visit \url{http://medepi.com} for the latest}
+\note{Visit \url{https://repitools.wordpress.com/} for the latest}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/as.hour.Rd b/man/as.hour.Rd
index 14324d4..bac163c 100644
--- a/man/as.hour.Rd
+++ b/man/as.hour.Rd
@@ -86,9 +86,9 @@ FALSE (default) for 1-hour categories; TRUE for
 \references{none}
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   epitools: \code{\link{as.month}}, \code{\link{epicurve.dates}}
diff --git a/man/as.month.Rd b/man/as.month.Rd
index a9cd08d..5238062 100644
--- a/man/as.month.Rd
+++ b/man/as.month.Rd
@@ -114,9 +114,9 @@ as.month(x, format = "\%Y-\%m-\%d",
 
 \references{none}
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   epitools: \code{\link{as.week}}, \code{\link{epicurve.dates}}
diff --git a/man/as.week.Rd b/man/as.week.Rd
index d981a90..5dbb2d2 100644
--- a/man/as.week.Rd
+++ b/man/as.week.Rd
@@ -123,9 +123,9 @@ as.week(x, format = "\%Y-\%m-\%d",
 \references{none}
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   epitools: \code{\link{as.month}}, \code{\link{epicurve.dates}}
diff --git a/man/binom.conf.int.Rd b/man/binom.conf.int.Rd
index c4ce3f7..25b7300 100644
--- a/man/binom.conf.int.Rd
+++ b/man/binom.conf.int.Rd
@@ -51,16 +51,16 @@ binom.approx(x, n, conf.level = 0.95)
 
 \references{
   Tomas Aragon, et al. Applied Epidemiology Using R. Available at
-  \url{http://medepi.com}
+  \url{http://www.phdata.science}
 
   Kenneth Rothman (2002), Epidemiology: An Introduction, Oxford
   University Press, 1st Edition.
 }
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
 \code{\link{pois.exact}}, \code{\link[stats]{binom.test}}
diff --git a/man/colorbrewer.Rd b/man/colorbrewer.Rd
index 686226a..e3210d4 100644
--- a/man/colorbrewer.Rd
+++ b/man/colorbrewer.Rd
@@ -82,10 +82,10 @@ ColorBrewer, by Cynthia Brewer, Pennsylvanis State University,
 
 \author{
   Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}
+  \url{http://www.phdata.science}
 }
 
-\note{Visit \url{http://medepi.com} for the latest.}
+
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/colors.plot.Rd b/man/colors.plot.Rd
index 2859923..b354780 100644
--- a/man/colors.plot.Rd
+++ b/man/colors.plot.Rd
@@ -55,9 +55,9 @@ colors.matrix()
 none
 }
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/epicurve.Rd b/man/epicurve.Rd
index 246ef0c..4c4f193 100644
--- a/man/epicurve.Rd
+++ b/man/epicurve.Rd
@@ -340,9 +340,9 @@ epicurve.table(x, width = 1, space = 0, tick = TRUE,
 \references{none}
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link[graphics]{barplot}}, \code{\link[base]{strptime}}
diff --git a/man/epidate.Rd b/man/epidate.Rd
index ad2d386..634f4ae 100644
--- a/man/epidate.Rd
+++ b/man/epidate.Rd
@@ -61,9 +61,9 @@ epidate(x, format = "\%m/\%d/\%Y", cal.dates = FALSE,
 
 \references{none}
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{epitools}: \code{\link{as.week}}
diff --git a/man/epitab.Rd b/man/epitab.Rd
index b049983..fae1473 100644
--- a/man/epitab.Rd
+++ b/man/epitab.Rd
@@ -153,9 +153,9 @@ epitab(x, y = NULL,
 }
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/epitable.Rd b/man/epitable.Rd
index 8b93298..f2792b9 100644
--- a/man/epitable.Rd
+++ b/man/epitable.Rd
@@ -52,9 +52,9 @@ epitable(..., ncol =2, byrow = TRUE,
 \references{none}
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{epitable}}
diff --git a/man/expand.table.Rd b/man/expand.table.Rd
index 54d8a1f..e131e70 100644
--- a/man/expand.table.Rd
+++ b/man/expand.table.Rd
@@ -53,13 +53,11 @@ expand.table(x)
 \references{none}
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}; Daniel Wollschlaeger,
+  \url{http://www.phdata.science}; Daniel Wollschlaeger,
   \email{dwoll at psychologie.uni-kiel.de},
   \url{http://www.uni-kiel.de/psychologie/dwoll/}
 }
 
-\note{Visit \url{http://www.epitools.net} for the latest.}
-
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
 \seealso{
diff --git a/man/expected.Rd b/man/expected.Rd
index 23f5740..6bb101e 100644
--- a/man/expected.Rd
+++ b/man/expected.Rd
@@ -33,9 +33,9 @@ expected(x)
   Oxford University Press
 }
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/julian2date.Rd b/man/julian2date.Rd
index 5553ebe..2de4acc 100644
--- a/man/julian2date.Rd
+++ b/man/julian2date.Rd
@@ -33,9 +33,9 @@ julian2date(x)
 
 \references{none}
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link[base]{format.Date}}, \code{\link[base]{weekdays}}
diff --git a/man/kapmeier.Rd b/man/kapmeier.Rd
index caadbd9..f4d60d6 100644
--- a/man/kapmeier.Rd
+++ b/man/kapmeier.Rd
@@ -54,9 +54,9 @@ Epidemiology and Biostatistics, V. 35). Oxford University Press; 3rd
 edition (May 1, 2004)
 }
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 
diff --git a/man/oddsratio.Rd b/man/oddsratio.Rd
index 8c4d17c..5ae5a36 100644
--- a/man/oddsratio.Rd
+++ b/man/oddsratio.Rd
@@ -156,9 +156,9 @@ oddsratio.small(x, y = NULL,
 } 
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{tab2by2.test}}, \code{\link{riskratio}},
diff --git a/man/or.midp.Rd b/man/or.midp.Rd
index 337ed76..21c929f 100644
--- a/man/or.midp.Rd
+++ b/man/or.midp.Rd
@@ -51,9 +51,9 @@ or.midp(x, conf.level = 0.95, byrow = TRUE, interval = c(0, 1000))
 } 
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{oddsratio}}
diff --git a/man/ormidp.test.Rd b/man/ormidp.test.Rd
index b6ec689..2a11dc4 100644
--- a/man/ormidp.test.Rd
+++ b/man/ormidp.test.Rd
@@ -52,9 +52,9 @@ ormidp.test(a1, a0, b1, b0, or = 1)
 } 
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{tab2by2.test}}, \code{\link{oddsratio}},
diff --git a/man/oswego.Rd b/man/oswego.Rd
index f03ac19..23c60df 100644
--- a/man/oswego.Rd
+++ b/man/oswego.Rd
@@ -112,6 +112,6 @@
   Supper (updated 2003):  S. aureus outbreak among church picnic
   attendees, 1940; the classic, straightforward outbreak investigation
   in a defined population. Training modules available at
-  \url{http://www.cdc.gov/eis/casestudies/casestudyex.htm}.
+  \url{https://www.cdc.gov/eis/casestudies/xoswego.401-303.student.pdf}.
 }
 \keyword{datasets}
diff --git a/man/pois.conf.int.Rd b/man/pois.conf.int.Rd
index 3475632..50f975e 100644
--- a/man/pois.conf.int.Rd
+++ b/man/pois.conf.int.Rd
@@ -53,7 +53,7 @@ pois.approx(x, pt = 1, conf.level = 0.95)
 
 \references{
   Tomas Aragon, et al. Applied Epidemiology Using R. Available at
-  \url{http://medepi.com} 
+  \url{http://www.phdata.science} 
 
   Leslie Day (1992), "Simple SAS macros for the calculation of exact 
   binomial and Poisson confidence limits." Comput Biol Med,
@@ -65,12 +65,12 @@ pois.approx(x, pt = 1, conf.level = 0.95)
 
 \author{
   Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com};
+  \url{https://repitools.wordpress.com/};
   with contributions by Francis Dimzon, \email{fdimzon at yahoo.com};
   with contributions by Scott Nabity, \email{scott.nabity at sfdph.org}
 }
 
-\note{Visit \url{http://medepi.com} for the latest.}
+
 
 
 \seealso{
diff --git a/man/probratio.Rd b/man/probratio.Rd
new file mode 100644
index 0000000..340af83
--- /dev/null
+++ b/man/probratio.Rd
@@ -0,0 +1,78 @@
+\name{probratio}
+\alias{probratio}
+
+\title{Obtain unbiased probability ratios from logistic regression models}
+
+\description{
+  Estimates probability (prevalence or risk) ratios from logistic regression models using either 
+  maximum likelihood or marginal standardization.
+  When using the latter, standard errors are calculated using the delta method or bootstrap.
+}
+
+\usage{
+probratio(object, parm, subset, method=c('ML', 'delta', 'bootstrap'), 
+  scale=c('linear', 'log'), level=0.95, seed, NREPS=100, ...)
+}
+
+
+\arguments{
+\item{object}{ a glm object with the family attribute equal to "binomial" }
+\item{parm}{ a specification of which parameters are to be sequentially assigned predicted responses, either a vector of numbers or a vector of names. If missing, all parameters are considered except the intercept which should not be used except when the method argument is "model".}
+\item{subset}{ a logical vector referring to which observations are included in the numerators and denominators of risk calculation. The default is TRUE, corresponding to a total population prediction ratios. User can supply subsets to calculate exposed population prediction ratios.}
+\item{method}{ One of three ways that standard errors of prediction ratios are calculate. Maximum likelihood uses relative risk regression directly. Delta-method uses asymptotically correct normal approximations to prediction ratios. }
+\item{scale}{ The scale on which marginal standardization calculates normal approximations to variability. When using ML, the log scale is the efficient parameterization.}
+\item{level}{ The confidence level for confidence intervals.}
+\item{seed}{ The random number generation seed}
+\item{NREPS}{ The number of bootstrap samples to be drawn}
+\item{...}{ Further arguments to glm when using maximum likelihood}
+}
+
+\details{
+  Estimates prevalence and risk ratios from logistic regression models using either maximum likelihood or marginal standardization.
+  Maximum likelihood is relative risk regression: a GLM with binomial variance structure and a log link.
+  Marginal standardization averages predicted probabilities from logistic regression models in the total sample or exposed sample to obtain prevalence or risk ratios.
+  Standard errors for marginal standardization estimates are calculated with the delta method or the normal bootstrap, which is not bias corrected.
+  Ratios can be estimated on the linear or log scale, which may lead to different inference due to the invariance of Wald statistics.
+}
+
+
+\value{
+  An array of ratios or log ratios, their standard errors, a z-score for a hypothesis test for the log ratio being different from 0 or the ratio being different from 1, the corresponding p-value, and the confidence interval for the estimate.
+}
+
+\references{
+Muller, Clemma J., and Richard F. MacLehose. "Estimating predicted probabilities from logistic regression: different methods correspond to different target populations." International journal of epidemiology 43.3 (2014): 962-970.
+
+Lumley, Thomas, Richard Kronmal, and Shuangge Ma. "Relative risk regression in medical research: models, contrasts, estimators, and algorithms." (2006).
+} 
+
+\author{Adam Omidpanah, \email{adam.omidpanah at wsu.edu}}
+
+\note{Maximum likelihood estimation via Newton Raphson may result in predicted probabilities greater than 1. This dominates estimating functions and leads to either false convergence or failure. Users should attempt to refit such models themselves using glms with the family argument binomial(link=log). By modifying inputs to glm.control, domination may be averted. An ideal first step is supplying starting coefficients. Input start=c(-log(p), 0,0,...,0) where p is the prevalence of the outcome.
+The current implementation of bootstrap standard errors, inference, and confidence intervals are not bias corrected. This will be updated in a later version.
+}
+
+\seealso{
+  \code{\link{glm}}, \code{\link{deriv}},w
+  \code{\link{predict.glm}}, \code{\link{family}}
+}
+
+\examples{
+  set.seed(123)
+  x <- rnorm(500)
+  y <- rbinom(500, 1, exp(-1 + .3*x))
+  logreg <- glm(y ~ x, family=binomial)
+  confint.default(logreg) ## 95\% CI over-estimates the 0.3 log-RR
+  pr1 <- probratio(logreg, method='ML', scale='log', start=c(log(mean(y)), 0)) 
+  
+  ## generally more efficient to calculate log-RR then exponentiate for non-symmetric 95\% CI
+  pr1 <- probratio(logreg, scale='log', method='delta')
+  pr2 <- probratio(logreg, scale='linear', method='delta')
+  exp(pr1[, 5:6])
+  pr2[, 5:6]
+}
+
+\keyword{models}
+\keyword{risk}
+
+%- \keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
diff --git a/man/rate2by2.test.Rd b/man/rate2by2.test.Rd
index 1a8f8b1..e258fb4 100644
--- a/man/rate2by2.test.Rd
+++ b/man/rate2by2.test.Rd
@@ -79,9 +79,9 @@ rate2by2.test(x, y = NULL, rr = 1,
 } 
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{rateratio}},
diff --git a/man/rateratio.Rd b/man/rateratio.Rd
index ec7fd3b..6368c1d 100644
--- a/man/rateratio.Rd
+++ b/man/rateratio.Rd
@@ -103,9 +103,9 @@ rateratio.wald(x, y = NULL,
 
 \author{Rita Shiau (original author), \email{rita.shiau at sfdph.org};
   Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{rate2by2.test}}, \code{\link{oddsratio}},
diff --git a/man/ratetable.Rd b/man/ratetable.Rd
index 196933e..892b511 100644
--- a/man/ratetable.Rd
+++ b/man/ratetable.Rd
@@ -56,9 +56,9 @@ ratetable(..., byrow = FALSE,
 \references{none}
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}} 
+  \url{http://www.phdata.science}} 
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{epitable}}
diff --git a/man/riskratio.Rd b/man/riskratio.Rd
index 0bc5a81..3dd5c67 100644
--- a/man/riskratio.Rd
+++ b/man/riskratio.Rd
@@ -136,9 +136,9 @@ riskratio.boot(x, y = NULL,
 } 
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{tab2by2.test}}, \code{\link{oddsratio}},
diff --git a/man/tab2by2.test.Rd b/man/tab2by2.test.Rd
index d1d8a5b..3eb2e50 100644
--- a/man/tab2by2.test.Rd
+++ b/man/tab2by2.test.Rd
@@ -85,9 +85,9 @@ tab2by2.test(x, y = NULL,
 } 
 
 \author{Tomas Aragon, \email{aragon at berkeley.edu},
-  \url{http://www.medepi.com}}
+  \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 \seealso{
   \code{\link{oddsratio}}, \code{\link{riskratio}}
diff --git a/man/table.margins.Rd b/man/table.margins.Rd
index dd7871d..b48174a 100644
--- a/man/table.margins.Rd
+++ b/man/table.margins.Rd
@@ -31,9 +31,9 @@ Calculates marginal totals of a matrix, table, or array.
 
 \references{none}
 
-\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.medepi.com}}
+\author{Tomas Aragon, \email{aragon at berkeley.edu}, \url{http://www.phdata.science}}
+
 
-\note{Visit \url{http://medepi.com} for the latest.}
 
 %- ~Make other sections like Warning with \section{Warning }{....} ~
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-epitools.git



More information about the debian-med-commit mailing list