Skip to content

Commit

Permalink
version 1.2-8
Browse files Browse the repository at this point in the history
  • Loading branch information
nshi-stat authored and cran-robot committed Mar 3, 2020
1 parent 74dc263 commit dcf1bd0
Show file tree
Hide file tree
Showing 19 changed files with 758 additions and 776 deletions.
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
Package: mmcm
Type: Package
Title: Modified Maximum Contrast Method
Version: 1.2-7
Version: 1.2-8
Authors@R: c(
person("Kengo", "Nagashima", email = "nshi1201@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-4529-9045")),
person("Yasunori", "Sato", role = c("aut")))
Imports: mvtnorm, OpenMPController
Imports: mvtnorm
Description: An implementation of modified maximum contrast methods (Sato et al. (2009) <doi:10.1038/tpj.2008.17>;
Nagashima et al. (2011) <doi:10.2202/1544-6115.1560>) and the maximum contrast method (Yoshimura et al. (1997)
<doi:10.1177/009286159703100213>): Functions mmcm.mvt() and mcm.mvt() give P-value by using randomized quasi-Monte
Carlo method with pmvt() function of package 'mvtnorm', and mmcm.resamp() gives P-value by using a permutation method.
License: GPL-3
RoxygenNote: 6.0.1
Encoding: UTF-8
RoxygenNote: 7.0.2
NeedsCompilation: yes
Packaged: 2018-02-26 05:46:05 UTC; NAGASHIMA
Packaged: 2020-03-03 19:06:21 UTC; nshi1
Author: Kengo Nagashima [aut, cre] (<https://orcid.org/0000-0003-4529-9045>),
Yasunori Sato [aut]
Maintainer: Kengo Nagashima <nshi1201@gmail.com>
Repository: CRAN
Date/Publication: 2018-02-26 11:42:42 UTC
Date/Publication: 2020-03-04 00:10:02 UTC
36 changes: 18 additions & 18 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
21fb0f401548f3ac21a6ee734fb8cb8c *DESCRIPTION
f8d2f86a8eb3d7906b8e9ecac9cd7e8f *NAMESPACE
2fb1d055c70ad789d09fcd93dd66f156 *NEWS.md
c7d39ce0f19faa3349f6ecfefc09771b *R/mcm.mvt.R
23d727ad84fd4cc9170db471bd10f19a *R/mmcm.mvt.R
580c405f762b55bb0983dd5f945cea6e *R/mmcm.resamp.R
62b0b61ec8c6745a7183ba0149d69bf3 *DESCRIPTION
a3259bae424c2ffc886a6d9a5197752e *NAMESPACE
8779f72aea6ab89d000e62dd0b0a8d8a *NEWS.md
e4df20d4ef83aaa7644855907d0191d6 *R/mcm.mvt.R
16d894115487303edd84caf32bea3d8e *R/mmcm.mvt.R
e5089c8169d24b7bfb60bdb441999114 *R/mmcm.resamp.R
2a2adf851a5c6ccc1973da435abe41cb *R/package.R
82c42fb0da3176c8683cda87e565191d *R/print.mmcm.R
e4ae4adfbeb49e7ee862151ed3f1ec6d *R/utils.R
2ebf449e7836eba51567a8c830319c76 *README.md
cf99cf87d37f5eea81cfca2a23c41d6b *inst/CITATION
003fdd71b8afc0bd4ec14d48011fe926 *man/mcm.mvt.Rd
9fd5a873ee2a4d0d75f5239b4590d4de *man/mmcm-package.Rd
62729137511444cb663be7caa2e6da51 *man/mmcm.mvt.Rd
396de21cf4945a742a574df5c67ec941 *man/mmcm.resamp.Rd
0beec9d851d36e349df90e322ae783ff *man/print.mmcm.Rd
5109f0b38d17f2e69a1418a1cc804039 *man/reexports.Rd
3aa4d79c226dafc525ce3c26da376e0e *src/Makevars
94cf30c8a4fb9675720721d73ce1aeb2 *src/mmcm.resamp.c
5626fa6c1969752e528c730b66efabf7 *src/mmcm.resamp.h
d37f1462bebf0baaa1c7b7be04db9b44 *src/packagename_init.c
932d7eeafe97aed6d49d3be9b80b9de8 *README.md
5a33c74816d6f6dbe1807e434d094733 *inst/CITATION
1ee7393564bb24a87d403f8158041962 *man/mcm.mvt.Rd
a9675194d81498e34fddae5dc78e33de *man/mmcm-package.Rd
e947d7d5f34409dc70c863b3ca7943cc *man/mmcm.mvt.Rd
d1935214625ee2d9d39e1f40bd29893f *man/mmcm.resamp.Rd
1ff90180b2ad073a207c800940048ec4 *man/print.mmcm.Rd
cc95d7f6a3584d78a46ab1d0fc6a8c78 *man/reexports.Rd
a50a482491952af759aa86ba625fc238 *src/Makevars
144b4e2a569c6bcc60a11876efa7b533 *src/mmcm.resamp.c
9ac2e6edeb6c2dc9f6cac617c2b80083 *src/mmcm.resamp.h
bf34d68701daf9291691616fda7b5e55 *src/packagename_init.c
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Generated by roxygen2: do not edit by hand
# Generated by roxygen2: do not edit by hand

S3method(print,mmcm)
export(GenzBretz)
export(mcm.mvt)
export(mmcm.mvt)
export(mmcm.resamp)
importFrom(OpenMPController,omp_set_num_threads)
importFrom(mvtnorm,GenzBretz)
importFrom(mvtnorm,pmvt)
importFrom(stats,var)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# The 'mmcm' package


## Changes in version 1.2-8 (2020-03-04)

* Updated for R 4.0.0


## Changes in version 1.2-7 (2018-02-26)

* Updated according to the CRAN policies
Expand Down
25 changes: 8 additions & 17 deletions R/mcm.mvt.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@
#'
#' ## Example 2 ##
#' # for dataframe
#' # true response pattern: pos = 1 dominant model c=( 1, 1, -2)
#' # 2 additive model c=(-1, 0, 1)
#' # 3 recessive model c=( 2, -1, -1)
#' # true response pattern:
#' # pos = 1 dominant model c=( 1, 1, -2)
#' # 2 additive model c=(-1, 0, 1)
#' # 3 recessive model c=( 2, -1, -1)
#' set.seed(3872435)
#' x <- c(
#' rnorm(130, mean = 1 / 6, sd = 1),
Expand All @@ -147,21 +148,11 @@
#' contrast <- rbind(
#' c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2)
#' )
#' mmcmtapply <- function(r) {
#' mcm.mvt(
#' xx$x[xx$pos==r[1]], xx$g[xx$pos==r[1]],
#' contrast
#' )
#' }
#' y <- tapply(xx$pos, xx$pos, mmcmtapply)
#' yy <- data.frame(
#' Pos = as.vector(names(y)),
#' Pval = as.vector(sapply(y, "[[", 3)),
#' Pattern = as.vector(sapply(y, "[[", 7)),
#' QMC_Error = as.vector(sapply(y, "[[", 9))
#' )
#' y <- by(xx, xx$pos, function(x) mmcm.mvt(x$x, x$g,
#' contrast))
#' y <- do.call(rbind, y)[,c(3,7,9)]
#' # miss-detection!
#' yy
#' y
#' @keywords htest
#' @importFrom stats var
#' @importFrom mvtnorm pmvt
Expand Down
25 changes: 8 additions & 17 deletions R/mmcm.mvt.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@
#'
#' ## Example 2 ##
#' # for dataframe
#' # true response pattern: pos = 1 dominant model c=( 1, 1, -2)
#' # 2 additive model c=(-1, 0, 1)
#' # 3 recessive model c=( 2, -1, -1)
#' # true response pattern:
#' # pos = 1 dominant model c=( 1, 1, -2)
#' # 2 additive model c=(-1, 0, 1)
#' # 3 recessive model c=( 2, -1, -1)
#' set.seed(3872435)
#' x <- c(
#' rnorm(130, mean = 1 / 6, sd = 1),
Expand All @@ -152,20 +153,10 @@
#' contrast <- rbind(
#' c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2)
#' )
#' mmcmtapply <- function(r) {
#' mmcm.mvt(
#' xx$x[xx$pos==r[1]], xx$g[xx$pos==r[1]],
#' contrast
#' )
#' }
#' y <- tapply(xx$pos, xx$pos, mmcmtapply)
#' yy <- data.frame(
#' Pos = as.vector(names(y)),
#' Pval = as.vector(sapply(y, "[[", 3)),
#' Pattern = as.vector(sapply(y, "[[", 7)),
#' QMC_Error = as.vector(sapply(y, "[[", 9))
#' )
#' yy
#' y <- by(xx, xx$pos, function(x) mmcm.mvt(x$x, x$g,
#' contrast))
#' y <- do.call(rbind, y)[,c(3,7,9)]
#' y
#' @keywords htest
#' @importFrom stats var
#' @importFrom mvtnorm pmvt
Expand Down
43 changes: 20 additions & 23 deletions R/mmcm.resamp.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
#' @param abseps specifies the absolute error tolerance (default: 0.001)
#' @param seed a single value, interpreted as an integer;
#' see \code{\link[base:Random]{set.seed()}} function. (default: NULL)
#' @param nthread sthe number of threads used in parallel computing, or FALSE
#' that means single threading (default: 2)
#' @return
#' \item{statistic}{the value of the test statistic with a name describing it.}
#' \item{p.value}{the p-value for the test.}
Expand All @@ -119,8 +121,6 @@
#' @seealso
#' \code{\link{mmcm.mvt}}
#' @examples
#' OpenMPController::omp_set_num_threads(2)
#'
#' ## Example 1 ##
#' # true response pattern: dominant model c=(1, 1, -2)
#' set.seed(136885)
Expand All @@ -142,14 +142,16 @@
#' contrast <- rbind(
#' c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2)
#' )
#' y <- mmcm.resamp(x, g, contrast, nsample = 20000, abseps = 0.01, seed = 5784324)
#' y <- mmcm.resamp(x, g, contrast, nsample = 20000,
#' abseps = 0.01, seed = 5784324)
#' y
#'
#' ## Example 2 ##
#' # for dataframe
#' # true response pattern: pos = 1 dominant model c=( 1, 1, -2)
#' # 2 additive model c=(-1, 0, 1)
#' # 3 recessive model c=( 2, -1, -1)
#' # true response pattern:
#' # pos = 1 dominant model c=( 1, 1, -2)
#' # 2 additive model c=(-1, 0, 1)
#' # 3 recessive model c=( 2, -1, -1)
#' set.seed(3872435)
#' x <- c(
#' rnorm(130, mean = 1 / 6, sd = 1),
Expand All @@ -163,7 +165,7 @@
#' rnorm( 10, mean = -1 / 6, sd = 1)
#' )
#' g <- rep(rep(1:3, c(130, 90, 10)), 3)
#' pos <- rep(c("rsXXXX", "rsYYYY", "rsZZZZ"), each=230)
#' pos <- rep(c("rsXXXX", "rsYYYY", "rsZZZZ"), each = 230)
#' xx <- data.frame(pos = pos, x = x, g = g)
#'
#' # coefficient matrix
Expand All @@ -172,26 +174,15 @@
#' c(-1, 0, 1), c(-2, 1, 1), c(-1, -1, 2)
#' )
#'
#' mmcmtapply <- function(r) {
#' mmcm.resamp(
#' xx$x[xx$pos==r[1]], xx$g[xx$pos==r[1]],
#' contrast, nsample = 10000, abseps = 0.01, seed = 5784324+as.numeric(r[1])
#' )
#' }
#' y <- tapply(xx$pos, xx$pos, mmcmtapply)
#' yy <- data.frame(
#' Pos = as.vector(names(y)),
#' Pval = as.vector(sapply(y, "[[", 3)),
#' Pattern = as.vector(sapply(y, "[[", 7)),
#' MC_Error = as.vector(sapply(y, "[[", 9))
#' )
#' yy
#' y <- by(xx, xx$pos, function(x) mmcm.resamp(x$x, x$g,
#' contrast, abseps = 0.02, nsample = 10000))
#' y <- do.call(rbind, y)[,c(3,7,9)]
#' y
#' @keywords htest
#' @importFrom stats var
#' @importFrom OpenMPController omp_set_num_threads
#' @export
mmcm.resamp <- function(x, g, contrast, alternative = c("two.sided", "less", "greater"),
nsample = 20000, abseps = 0.001, seed = NULL) {
nsample = 20000, abseps = 0.001, seed = NULL, nthread = 2) {

####################
# executable check
Expand All @@ -215,6 +206,11 @@ mmcm.resamp <- function(x, g, contrast, alternative = c("two.sided", "less", "gr
if (!is.matrix(contrast)) {
stop(paste(DNAMEC, "must be a matrix"))
}
if (!is.numeric(nthread)) {
nthread <- 1
} else if (nthread < 1) {
nthread <- 1
}

x <- x[is.finite(x)]
g <- g[is.finite(g)]
Expand Down Expand Up @@ -289,6 +285,7 @@ mmcm.resamp <- function(x, g, contrast, alternative = c("two.sided", "less", "gr
as.integer(length(x)),
as.double(abseps),
as.integer(nalternative),
as.integer(nthread),
pval=double(1),
error=double(1)
)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ give P-value by using randomized quasi-Monte Carlo method with
'pmvt' function of package 'mvtnorm', and 'mmcm.resamp' gives
P-value by using a permutation method.

- Sato Y, Laird NM, Nagashima K, et al. A new statistical screening approach for finding pharmacokinetics-related genes in genome-wide studies. *The Pharmacogenomics Journal* 2009; **9**(2): 137--146. [doi:10.1038/tpj.2008.17](https://doi.org/10.1038/tpj.2008.17).
- Nagashima K, Sato Y, Hamada C. A modified maximum contrast method for unequal sample sizes in pharmacogenomic studies. *Statistical Applications in Genetics and Molecular Biology* 2011; **10**(1): Article 41. [doi:10.2202/1544-6115.1560](https://doi.org/10.2202/1544-6115.1560).
- Yoshimura I, Wakana A, Hamada C. A performance comparison of maximum contrast methods to detect dose dependency. *Drug Informatoion Journal* 1997; **31**(2): 423--432. [doi:10.1177/009286159703100213](https://doi.org/10.1177/009286159703100213).


## Installation

Expand Down
46 changes: 23 additions & 23 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
citHeader("To cite", sQuote("mmcm"), "in publications, please use:")

citEntry(
entry = "Article",
title = "A modified maximum contrast method for unequal sample sizes in pharmacogenomic studies",
author = personList(
as.person("Kengo NAGASHIMA"),
as.person("Yasunori SATO"),
as.person("Chikuma HAMADA")
),
journal = "Statistical Applications in Genetics and Molecular Biology",
year = "2011",
volume = "10",
number = "1",
pages = "Article 41",
url = "http://dx.doi.org/10.2202/1544-6115.1560",
textVersion = paste(
"Nagashima, K., Sato, Y., Hamada, C. (2011).",
"A modified maximum contrast method for unequal sample sizes in pharmacogenomic studies",
"Stat Appl Genet Mol Biol. 10(1): Article 41.",
"URL: http://dx.doi.org/10.2202/1544-6115.1560"
)
)
citHeader("To cite", sQuote("mmcm"), "in publications, please use:")
citEntry(
entry = "Article",
title = "A modified maximum contrast method for unequal sample sizes in pharmacogenomic studies",
author = personList(
as.person("Kengo NAGASHIMA"),
as.person("Yasunori SATO"),
as.person("Chikuma HAMADA")
),
journal = "Statistical Applications in Genetics and Molecular Biology",
year = "2011",
volume = "10",
number = "1",
pages = "Article 41",
url = "http://dx.doi.org/10.2202/1544-6115.1560",
textVersion = paste(
"Nagashima, K., Sato, Y., Hamada, C. (2011).",
"A modified maximum contrast method for unequal sample sizes in pharmacogenomic studies",
"Stat Appl Genet Mol Biol. 10(1): Article 41.",
"URL: http://dx.doi.org/10.2202/1544-6115.1560"
)
)

0 comments on commit dcf1bd0

Please sign in to comment.