Binary files /tmp/tmpHnEIKV/760w9AHbfe/r-cran-coin-1.1-0/build/vignette.rds and /tmp/tmpHnEIKV/OnhKoy0KZd/r-cran-coin-1.1-2/build/vignette.rds differ diff -Nru r-cran-coin-1.1-0/debian/changelog r-cran-coin-1.1-2/debian/changelog --- r-cran-coin-1.1-0/debian/changelog 2015-09-10 14:53:05.000000000 +0000 +++ r-cran-coin-1.1-2/debian/changelog 2015-12-19 10:52:01.000000000 +0000 @@ -1,3 +1,9 @@ +r-cran-coin (1.1-2-1) unstable; urgency=low + + * New upstream release + + -- Jonathon Love Sat, 19 Dec 2015 15:21:53 +1100 + r-cran-coin (1.1-0-1) unstable; urgency=low * Initial release. (Closes: #797818) diff -Nru r-cran-coin-1.1-0/DESCRIPTION r-cran-coin-1.1-2/DESCRIPTION --- r-cran-coin-1.1-0/DESCRIPTION 2015-08-16 06:25:27.000000000 +0000 +++ r-cran-coin-1.1-2/DESCRIPTION 2015-11-16 15:20:12.000000000 +0000 @@ -1,6 +1,6 @@ Package: coin -Version: 1.1-0 -Date: 2015-08-14 +Version: 1.1-2 +Date: 2015-11-13 Title: Conditional Inference Procedures in a Permutation Test Framework Authors@R: c(person("Torsten", "Hothorn", role = c("aut", "cre"), email = "Torsten.Hothorn@R-project.org"), @@ -14,13 +14,12 @@ Depends: R (>= 2.14.0), methods, survival Imports: stats, modeltools (>= 0.2-9), mvtnorm (>= 1.0-3), multcomp Suggests: parallel, xtable, e1071, vcd, TH.data -Enhances: Biobase LazyData: yes NeedsCompilation: yes ByteCompile: yes License: GPL-2 URL: http://coin.r-forge.r-project.org -Packaged: 2015-08-14 13:18:53 UTC; hothorn +Packaged: 2015-11-16 10:15:00 UTC; hothorn Author: Torsten Hothorn [aut, cre], Kurt Hornik [aut], Mark A. van de Wiel [aut], @@ -28,4 +27,4 @@ Achim Zeileis [aut] Maintainer: Torsten Hothorn Repository: CRAN -Date/Publication: 2015-08-16 08:25:27 +Date/Publication: 2015-11-16 16:20:12 Binary files /tmp/tmpHnEIKV/760w9AHbfe/r-cran-coin-1.1-0/inst/doc/coin_implementation.pdf and /tmp/tmpHnEIKV/OnhKoy0KZd/r-cran-coin-1.1-2/inst/doc/coin_implementation.pdf differ Binary files /tmp/tmpHnEIKV/760w9AHbfe/r-cran-coin-1.1-0/inst/doc/coin.pdf and /tmp/tmpHnEIKV/OnhKoy0KZd/r-cran-coin-1.1-2/inst/doc/coin.pdf differ diff -Nru r-cran-coin-1.1-0/inst/doc/coin.R r-cran-coin-1.1-2/inst/doc/coin.R --- r-cran-coin-1.1-0/inst/doc/coin.R 2015-08-14 13:18:53.000000000 +0000 +++ r-cran-coin-1.1-2/inst/doc/coin.R 2015-11-16 10:15:00.000000000 +0000 @@ -5,8 +5,6 @@ ################################################### options(width = 60) require("coin") -require("Biobase") -require("multcomp") set.seed(290875) @@ -19,19 +17,20 @@ 42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 38, 33, 26, 25, 28, 28, 26, 27, 27, 27, 31, 30, 27, 29, 30, 25, 25, 24, 27, 30), - site = factor(c(rep("I", 10), rep("II", 10), - rep("III", 10), rep("IV", 10)))) + site = gl(4, 10, labels = as.roman(1:4)) +) it <- independence_test(length ~ site, data = YOY, - ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo), - teststat = "quadratic") + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo), + teststat = "quadratic") it ################################################### ### code chunk number 3: YOY-T ################################################### -statistic(it, "linear") +statistic(it, type = "linear") ################################################### @@ -62,15 +61,15 @@ ################################################### ### code chunk number 8: YOY-KW ################################################### -kw <- kruskal_test(length ~ site, data = YOY, - distribution = approximate(B = 9999)) -kw +kt <- kruskal_test(length ~ site, data = YOY, + distribution = approximate(B = 10000)) +kt ################################################### ### code chunk number 9: YOY-KWp ################################################### -pvalue(kw) +pvalue(kt) ################################################### @@ -78,14 +77,14 @@ ################################################### data("jobsatisfaction", package = "coin") -it <- cmh_test(jobsatisfaction) -it +ct <- cmh_test(jobsatisfaction) +ct ################################################### ### code chunk number 11: jobsatisfaction-s ################################################### -statistic(it, type = "standardized") +statistic(ct, type = "standardized") ################################################### @@ -103,77 +102,73 @@ ################################################### -### code chunk number 14: eggs-Durbin +### code chunk number 14: jobsatisfaction-lbl-sc-alt +################################################### +lbl_test(jobsatisfaction, + ytrafo = function(data) + trafo(data, ordered_trafo = function(y) + of_trafo(y, scores = c(1, 3, 4, 5))), + xtrafo = function(data) + trafo(data, ordered_trafo = function(x) + of_trafo(x, scores = c(3, 10, 20, 35)))) + + +################################################### +### code chunk number 15: eggs-Durbin ################################################### egg_data <- data.frame( - scores = c(9.7, 8.7, 5.4, 5.0, 9.6, 8.8, 5.6, 3.6, 9.0, + scores = c(9.7, 8.7, 5.4, 5.0, 9.6, 8.8, 5.6, 3.6, 9.0, 7.3, 3.8, 4.3, 9.3, 8.7, 6.8, 3.8, 10.0, 7.5, - 4.2, 2.8, 9.6, 5.1, 4.6, 3.6, 9.8, 7.4, 4.4, - 3.8, 9.4, 6.3, 5.1, 2.0, 9.4, 9.3, 8.2, 3.3, - 8.7, 9.0, 6.0, 3.3, 9.7, 6.7, 6.6, 2.8, 9.3, - 8.1, 3.7, 2.6, 9.8, 7.3, 5.4, 4.0, 9.0, 8.3, - 4.8,3.8,9.3,8.3,6.3,3.8), - sitting = factor(rep(c(1:15), rep(4,15))), - product = factor(c(1, 2, 4, 5, 2, 3, 6, 10, 2, 4, 6, 7, - 1, 3, 5, 7, 1, 4, 8, 10, 2, 7, 8, 9, - 2, 5, 8, 10, 5, 7, 9, 10, 1, 2, 3, 9, - 4, 5, 6, 9, 1, 6, 7, 10, 3, 4, 9, 10, - 1, 6, 8, 9, 3, 4, 7, 8, 3, 5, 6, 8))) -yt <- function(data) trafo(data, numeric_trafo = rank_trafo, - block = egg_data$sitting) + 4.2, 2.8, 9.6, 5.1, 4.6, 3.6, 9.8, 7.4, 4.4, + 3.8, 9.4, 6.3, 5.1, 2.0, 9.4, 9.3, 8.2, 3.3, + 8.7, 9.0, 6.0, 3.3, 9.7, 6.7, 6.6, 2.8, 9.3, + 8.1, 3.7, 2.6, 9.8, 7.3, 5.4, 4.0, 9.0, 8.3, + 4.8, 3.8, 9.3, 8.3, 6.3, 3.8), + sitting = factor(rep(c(1:15), rep(4, 15))), + product = factor(c(1, 2, 4, 5, 2, 3, 6, 10, 2, 4, 6, 7, + 1, 3, 5, 7, 1, 4, 8, 10, 2, 7, 8, 9, + 2, 5, 8, 10, 5, 7, 9, 10, 1, 2, 3, 9, + 4, 5, 6, 9, 1, 6, 7, 10, 3, 4, 9, 10, + 1, 6, 8, 9, 3, 4, 7, 8, 3, 5, 6, 8)) +) + independence_test(scores ~ product | sitting, - data = egg_data, teststat = "quadratic", - ytrafo = yt) + data = egg_data, teststat = "quadratic", + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting)) ################################################### -### code chunk number 15: eggs-Durbin-approx +### code chunk number 16: eggs-Durbin-approx ################################################### pvalue(independence_test(scores ~ product | sitting, - data = egg_data, teststat = "quadratic", ytrafo = yt, - distribution = approximate(B = 19999))) + data = egg_data, teststat = "quadratic", + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting), + distribution = approximate(B = 19999))) ################################################### -### code chunk number 16: eggs-Durbin-approx +### code chunk number 17: eggs-Page ################################################### -independence_test(scores ~ product | sitting, data = egg_data, - scores = list(product = 1:10), - ytrafo = yt) +independence_test(scores ~ product | sitting, + data = egg_data, + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting), + scores = list(product = 1:10)) ################################################### -### code chunk number 17: warpbreaks-Tukey -################################################### -if (require("multcomp")) { - xt <- function(data) trafo(data, factor_trafo = function(x) - tcrossprod(model.matrix(~x - 1), contrMat(table(x), "Tukey"))) - it <- independence_test(length ~ site, data = YOY, xtrafo = xt, - teststat = "maximum", distribution = approximate(B = 9999)) - print(pvalue(it)) - print(pvalue(it, method = "single-step")) -} - - +### code chunk number 18: warpbreaks-Tukey ################################################### -### code chunk number 18: biobase-resampling (eval = FALSE) -################################################### -## if (require("Biobase")) { -## -## p <- 100 -## pd <- new("AnnotatedDataFrame", -## data = data.frame(group = gl(2, 20)), -## varMetadata = data.frame(labelDescription = "1/2")) -## exprs <- matrix(rnorm(p * 40), nrow = p) -## exprs[1, 1:20] <- exprs[1, 1:20] + 1.5 -## ex <- new("ExpressionSet", exprs = exprs, phenoData = pd) -## -## it <- independence_test(group ~ ., data = ex, -## distribution = approximate(B = 1000)) -## -## print(pvalue(it)) -## print(which(pvalue(it, method = "step-down") < 0.05)) -## -## } +it <- independence_test(length ~ site, data = YOY, + xtrafo = mcp_trafo(site = "Tukey"), + teststat = "maximum", + distribution = "approximate") +pvalue(it) +pvalue(it, method = "single-step") diff -Nru r-cran-coin-1.1-0/inst/doc/coin.Rnw r-cran-coin-1.1-2/inst/doc/coin.Rnw --- r-cran-coin-1.1-0/inst/doc/coin.Rnw 2015-08-14 13:18:53.000000000 +0000 +++ r-cran-coin-1.1-2/inst/doc/coin.Rnw 2015-11-16 10:15:00.000000000 +0000 @@ -1,4 +1,5 @@ -\documentclass[letter]{article} +\documentclass[a4paper]{article} +\usepackage[a4paper]{geometry} \usepackage{amstext} \usepackage{amsfonts} \usepackage{hyperref} @@ -12,7 +13,7 @@ \SweaveOpts{engine=R, eps=FALSE, keep.source = TRUE} %%\VignetteIndexEntry{coin: A Computational Framework for Conditional Inference} -%%\VignetteDepends{coin,multcomp} +%%\VignetteDepends{coin} \input{head} @@ -33,7 +34,8 @@ \begin{document} -\title{\pkg{coin}: A Computational Framework for Conditional Inference} +\title{\pkg{coin}: A Computational Framework for \\ + Conditional Inference} \author{Torsten Hothorn$^1$, Kurt Hornik$^2$, Mark van de Wiel$^3$ \\ and Achim Zeileis$^2$} \date{} @@ -60,65 +62,86 @@ <>= options(width = 60) require("coin") -require("Biobase") -require("multcomp") set.seed(290875) @ \section{Introduction} -The \pkg{coin} package implements a unified approach for conditional +The \pkg{coin} package provides a unified approach to conditional inference procedures commonly known as \textit{permutation tests}. -The theoretical basis of design and implementation is the unified -framework for permutation tests given by \cite{strasserweber1999}. For a +The theoretical basis for the design and implementation is the general +framework for permutation tests given by \cite{strasserweber1999}. For a very flexible formulation of multivariate linear statistics, \cite{strasserweber1999} derived the conditional expectation and covariance of the conditional (permutation) distribution as well as the multivariate -limiting distribution. For a more detailed overview see \cite{Hothorn:2006:AmStat}. +limiting distribution. Test procedures for nominal, ordinal and continuous data +with or without censoring are all part of this framework. For a more detailed +overview see \cite{Hothorn:2006:AmStat}. + +The conceptual Strasser-Weber framework of permutation tests +for arbitrary independence and symmetry problems are available via the generic +functions \texttt{independence\_test} and \texttt{symmetry\_test} respectively. +In addition to these very flexible procedures, a large set of convenience +functions including well-known as well as lesser-known classical and +non-classical procedures for tests of independence between two continuous +variables, two- and $K$-sample tests for location and scale alternatives, tests +of independence for contingency tables as well as tests of marginal homogeneity +and symmetry have been implemented within the framework. Currently, the +following conditional test procedures are available: -Conditional counterparts of a large amount of classical (unconditional) -test procedures for -continuous, categorical and censored data are part of this framework, for -example the Cochran-Mantel-Haenszel test for independence in general -contingency tables, linear association tests for ordered categorical -data, linear rank tests and multivariate permutation tests. - -The conceptual framework of permutation tests by \cite{strasserweber1999} -for arbitrary problems is available via the generic -\texttt{independence\_test}. Because convenience functions for the most -prominent problems are available, users will not have to use this -extremely flexible procedure. Currently, the conditional variants of the -following test procedures are available: \begin{center} -\begin{tabular}{ll} -\texttt{oneway\_test} & two- and $K$-sample permutation test \\ -\texttt{wilcox\_test} & Wilcoxon-Mann-Whitney test \\ -\texttt{normal\_test} & van der Waerden normal quantile test \\ -\texttt{median\_test} & median test \\ -\texttt{kruskal\_test} & Kruskal-Wallis test \\ -\texttt{ansari\_test} & Ansari-Bradley test \\ -\texttt{fligner\_test} & Fligner-Killeen test \\ -\texttt{chisq\_test} & Pearson's $\chi^2$ test \\ -\texttt{cmh\_test} & Cochran-Mantel-Haenszel test \\ -\texttt{lbl\_test} & linear-by-linear association test \\ -\texttt{surv\_test} & two- and $K$-sample logrank test \\ -\texttt{maxstat\_test} & generalized maximally selected statistics \\ -\texttt{spearman\_test} & Spearman's test \\ -\texttt{friedman\_test} & Friedman test \\ -\texttt{wilcoxsign\_test} & Wilcoxon signed-rank test \\ -\texttt{mh\_test} & marginal homogeneity test (Stuart-Maxwell). \\ -\end{tabular} + \begin{tabular}{ll} + % CorrelationTests + \texttt{spearman\_test} & Spearman correlation test \\ + \texttt{fisyat\_test} & Fisher-Yates correlation test \\ + \texttt{quadrant\_test} & Quadrant test \\ + \texttt{koziol\_test} & Koziol-Nemec test \\ + % LocationTests + \texttt{oneway\_test} & Two- and $K$-sample Fisher-Pitman permutation + test \\ + \texttt{wilcox\_test} & Wilcoxon-Mann-Whitney test \\ + \texttt{kruskal\_test} & Kruskal-Wallis test \\ + \texttt{normal\_test} & Two- and $K$-sample van der Waerden test \\ + \texttt{median\_test} & Two- and $K$-sample Brown-Mood median test \\ + \texttt{savage\_test} & Two- and $K$-sample Savage test \\ + % ScaleTests + \texttt{taha\_test} & Two- and $K$-sample Taha test \\ + \texttt{klotz\_test} & Two- and $K$-sample Klotz test \\ + \texttt{mood\_test} & Two- and $K$-sample Mood test \\ + \texttt{ansari\_test} & Two- and $K$-sample Ansari-Bradley test \\ + \texttt{fligner\_test} & Two- and $K$-sample Fligner-Killeen test \\ + \texttt{conover\_test} & Two- and $K$-sample Conover-Iman test \\ + % SurvivalTests + \texttt{logrank\_test} & Two- and $K$-sample weighted logrank tests \\ + & (Logrank test, Gehan-Breslow test, Tarone-Ware + test, \dots) \\ + % SymmetryTests + \texttt{sign\_test} & Sign test \\ + \texttt{wilcoxsign\_test} & Wilcoxon signed-rank test \\ + \texttt{friedman\_test} & Friedman test and Page test \\ + \texttt{quade\_test} & Quade test \\ + % ContingencyTests + \texttt{chisq\_test} & Pearson $\chi^2$ test \\ + \texttt{cmh\_test} & Generalized Cochran-Mantel-Haenszel test \\ + \texttt{lbl\_test} & Linear-by-linear association test \\ + % MarginalHomogeneityTests + \texttt{mh\_test} & Marginal homogeneity tests \\ + & (McNemar test, Cochran $Q$ test, Stuart-Maxwell + test, \dots) \\ + % MaximallySelectedStatisticsTests + \texttt{maxstat\_test} & Generalized maximally selected statistics \\ + \end{tabular} \end{center} -Those convenience functions essentially perform a certain transformation of -the data, e.g., a rank transformation, and call \texttt{independence\_test} -for the computation of linear statistics, expectation and covariance and the -test statistic as well as -their null distribution. The exact null distribution can -be approximated either by the asymptotic distribution or via conditional -Monte Carlo for all test procedures, the exact null distribution is -available for special cases. Moreover, all test procedures allow for the -specification of blocks for stratification. +These convenience functions essentially perform a certain transformation of +the data, e.g., a rank transformation, and then call \texttt{independence\_test} +or \texttt{symmetry\_test} for the computation of the (multivariate) linear +statistic and its conditional expectation and covariance as well as the scalar +test statistic and its null distribution. The exact null distribution can +be approximated by the asymptotic distribution or via conditional +Monte Carlo resampling for all test procedures, whereas the exact null distribution is +available for special cases only. Moreover, all test procedures allow for the +specification of blocks pertaining to, e.g., stratification or repeated measurements. \section{Permutation Tests} @@ -146,11 +169,11 @@ \in \R^{pq}. \end{eqnarray} Here, $g: \mathcal{X} \rightarrow \R^{p}$ is a transformation of -the $\X$ measurements and the \emph{influence function} -$h: \mathcal{Y} \times \mathcal{Y}^n \rightarrow -\R^q$ depends on the responses $(\Y_1, \dots, \Y_n)$ in a permutation -symmetric way. We will give specific examples how to choose $g$ and $h$ -later on. +$\X$ known as the \emph{regression function} and $h: \mathcal{Y} \times +\mathcal{Y}^n \rightarrow \R^q$ is a transformation of $\Y$ known as the +\emph{influence function}, where the latter may depend on $(\Y_1, \dots, \Y_n)$ +in a permutation symmetric way. We will give specific examples on how to choose +$g$ and $h$ later on. The distribution of $\T$ depends on the joint distribution of $\Y$ and $\X$, which is unknown under almost all practical @@ -230,7 +253,7 @@ The conditional distribution and thus the $p$-value of the statistics $c(\mathbf{t}, \mu, \Sigma)$ can be computed in several different ways. For some special forms of the -linear statistic, the exact distribution of the test statistic is trackable. +linear statistic, the exact distribution of the test statistic is tractable. For two-sample problems, the shift-algorithm by \cite{axact-dist:1986} and \cite{exakte-ver:1987} and the split-up algorithm by \cite{vdWiel2001} are implemented as part of the package. @@ -254,9 +277,9 @@ The main workhorse \texttt{independence\_test} essentially allows for the specification of $\Y, \X$ and $b$ through a formula interface of the form -\verb/y ~ x | b/, weights can be defined by a formula with one variable on +\verb/y ~ x | b/, case weights can be defined by a formula with one variable on the right hand side only. Four additional arguments are available for the -specification of the transformation $g$ (\texttt{xtrans}), the influence +specification of the regression function $g$ (\texttt{xtrans}), the influence function $h$ (\texttt{ytrans}), the form of the test statistic $c$ (\texttt{teststat}) and the null distribution (\texttt{distribution}). @@ -277,18 +300,19 @@ 42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 38, 33, 26, 25, 28, 28, 26, 27, 27, 27, 31, 30, 27, 29, 30, 25, 25, 24, 27, 30), - site = factor(c(rep("I", 10), rep("II", 10), - rep("III", 10), rep("IV", 10)))) + site = gl(4, 10, labels = as.roman(1:4)) +) it <- independence_test(length ~ site, data = YOY, - ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo), - teststat = "quadratic") + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo), + teststat = "quadratic") it @ The linear statistic $\T$ is the sum of the ranks in each group and can be extracted via <>= -statistic(it, "linear") +statistic(it, type = "linear") @ Note that \texttt{statistic(..., type = "linear")} currently returns the linear statistic in matrix form, i.e. @@ -318,17 +342,17 @@ @ Life is much simpler with convenience functions very similar to those -available in package \pkg{stats} for a long time. The exact -null distribution of the Kruskal-Wallis test can be approximated by $9999$ -Monte Carlo replications via +available in package \pkg{stats} for a long time. Here, the exact +null distribution of the Kruskal-Wallis test is approximated by Monte Carlo +resampling using $10000$ replicates via <>= -kw <- kruskal_test(length ~ site, data = YOY, - distribution = approximate(B = 9999)) -kw +kt <- kruskal_test(length ~ site, data = YOY, + distribution = approximate(B = 10000)) +kt @ -with $p$-value (and $99\%$ confidence interval) of +with $p$-value (and $99~\%$ confidence interval) of <>= -pvalue(kw) +pvalue(kt) @ Of course it is possible to choose a $c_\text{max}$ type test statistic instead of a quadratic form. @@ -342,45 +366,55 @@ <>= data("jobsatisfaction", package = "coin") -it <- cmh_test(jobsatisfaction) -it +ct <- cmh_test(jobsatisfaction) +ct @ The standardized contingency table allowing for an inspection of the deviation from the null hypothesis of independence of income and jobsatisfaction (stratified by gender) is <>= -statistic(it, type = "standardized") +statistic(ct, type = "standardized") @ \paragraph{Ordered Alternatives.} Of course, both job satisfaction and income are ordered variables. When $\Y$ is measured at $J$ levels and $\X$ at $K$ levels, -$\Y$ and $\X$ are associated with score vectors $\xi \in +$\Y$ and $\X$ are associated with score vectors $\eta \in \R^J$ and $\gamma \in \R^K$, respectively. The linear statistic is now a linear combination of the linear statistic $\T$ of the form \begin{eqnarray*} \M \T & = & \vec \left( \sum_{i=1}^n w_i \gamma^\top g(\X_i) - \left(\xi^\top h(\Y_i, (\Y_1, \dots, \Y_n)\right)^\top \right) -\in \R \text{ with } \M = \xi \otimes \gamma. + \left(\eta^\top h(\Y_i, (\Y_1, \dots, \Y_n)\right)^\top \right) +\in \R \text{ with } \M = \eta \otimes \gamma. \end{eqnarray*} -By default, scores are $\xi = 1, \dots, J$ and $\gamma = 1, \dots, K$. +By default, scores are $\eta = 1, \dots, J$ and $\gamma = 1, \dots, K$. <>= lbl_test(jobsatisfaction) @ -The scores $\xi$ and $\gamma$ can be specified to the linear-by-linear -association test via a list those names correspond to the variable names +The scores $\eta$ and $\gamma$ can be specified to the linear-by-linear +association test via a list whose names correspond to the variable names <>= lbl_test(jobsatisfaction, scores = list(Job.Satisfaction = c(1, 3, 4, 5), Income = c(3, 10, 20, 35))) @ +Alternatively, scores can be specified through \texttt{of\_trafo} +<>= +lbl_test(jobsatisfaction, + ytrafo = function(data) + trafo(data, ordered_trafo = function(y) + of_trafo(y, scores = c(1, 3, 4, 5))), + xtrafo = function(data) + trafo(data, ordered_trafo = function(x) + of_trafo(x, scores = c(3, 10, 20, 35)))) +@ \paragraph{Incomplete Randomised Blocks.} \cite{RaynerBest2001}, Chapter 7, discuss the application of Durbin's test -to data from sensoric experiments, where incomplete block designs are +to data from sensory experiments, where incomplete block designs are common. As an example, data from taste-testing on ten dried eggs where mean scores for off-flavour from seven judges are given and one wants to assess whether there is any difference in the scores between the ten egg samples. @@ -388,55 +422,60 @@ `\texttt{|}'. <>= egg_data <- data.frame( - scores = c(9.7, 8.7, 5.4, 5.0, 9.6, 8.8, 5.6, 3.6, 9.0, + scores = c(9.7, 8.7, 5.4, 5.0, 9.6, 8.8, 5.6, 3.6, 9.0, 7.3, 3.8, 4.3, 9.3, 8.7, 6.8, 3.8, 10.0, 7.5, - 4.2, 2.8, 9.6, 5.1, 4.6, 3.6, 9.8, 7.4, 4.4, - 3.8, 9.4, 6.3, 5.1, 2.0, 9.4, 9.3, 8.2, 3.3, - 8.7, 9.0, 6.0, 3.3, 9.7, 6.7, 6.6, 2.8, 9.3, - 8.1, 3.7, 2.6, 9.8, 7.3, 5.4, 4.0, 9.0, 8.3, - 4.8,3.8,9.3,8.3,6.3,3.8), - sitting = factor(rep(c(1:15), rep(4,15))), - product = factor(c(1, 2, 4, 5, 2, 3, 6, 10, 2, 4, 6, 7, - 1, 3, 5, 7, 1, 4, 8, 10, 2, 7, 8, 9, - 2, 5, 8, 10, 5, 7, 9, 10, 1, 2, 3, 9, - 4, 5, 6, 9, 1, 6, 7, 10, 3, 4, 9, 10, - 1, 6, 8, 9, 3, 4, 7, 8, 3, 5, 6, 8))) -yt <- function(data) trafo(data, numeric_trafo = rank_trafo, - block = egg_data$sitting) + 4.2, 2.8, 9.6, 5.1, 4.6, 3.6, 9.8, 7.4, 4.4, + 3.8, 9.4, 6.3, 5.1, 2.0, 9.4, 9.3, 8.2, 3.3, + 8.7, 9.0, 6.0, 3.3, 9.7, 6.7, 6.6, 2.8, 9.3, + 8.1, 3.7, 2.6, 9.8, 7.3, 5.4, 4.0, 9.0, 8.3, + 4.8, 3.8, 9.3, 8.3, 6.3, 3.8), + sitting = factor(rep(c(1:15), rep(4, 15))), + product = factor(c(1, 2, 4, 5, 2, 3, 6, 10, 2, 4, 6, 7, + 1, 3, 5, 7, 1, 4, 8, 10, 2, 7, 8, 9, + 2, 5, 8, 10, 5, 7, 9, 10, 1, 2, 3, 9, + 4, 5, 6, 9, 1, 6, 7, 10, 3, 4, 9, 10, + 1, 6, 8, 9, 3, 4, 7, 8, 3, 5, 6, 8)) +) + independence_test(scores ~ product | sitting, - data = egg_data, teststat = "quadratic", - ytrafo = yt) + data = egg_data, teststat = "quadratic", + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting)) @ and the Monte Carlo $p$-value can be computed via <>= pvalue(independence_test(scores ~ product | sitting, - data = egg_data, teststat = "quadratic", ytrafo = yt, - distribution = approximate(B = 19999))) + data = egg_data, teststat = "quadratic", + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting), + distribution = approximate(B = 19999))) @ If we assume that the products are ordered, the Page test is appropriate and can be computed as follows -<>= -independence_test(scores ~ product | sitting, data = egg_data, - scores = list(product = 1:10), - ytrafo = yt) +<>= +independence_test(scores ~ product | sitting, + data = egg_data, + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting), + scores = list(product = 1:10)) @ - \paragraph{Multiple Tests.} One may be interested in testing multiple hypotheses simultaneously, either by using a linear combination of the linear statistic $\K\T$, or by -specifying multivariate variables $\Y$ and / or $\X$. For example, all pair +specifying multivariate variables $\Y$ and/or $\X$. For example, all pair comparisons may be implemented via <>= -if (require("multcomp")) { - xt <- function(data) trafo(data, factor_trafo = function(x) - tcrossprod(model.matrix(~x - 1), contrMat(table(x), "Tukey"))) - it <- independence_test(length ~ site, data = YOY, xtrafo = xt, - teststat = "maximum", distribution = approximate(B = 9999)) - print(pvalue(it)) - print(pvalue(it, method = "single-step")) -} +it <- independence_test(length ~ site, data = YOY, + xtrafo = mcp_trafo(site = "Tukey"), + teststat = "maximum", + distribution = "approximate") +pvalue(it) +pvalue(it, method = "single-step") @ When either $g$ or $h$ are multivariate, single-step adjusted $p$-values based on maximum-type statistics are computed as described in \cite{WestfallYoung1993}, @@ -447,34 +486,6 @@ treatment effect of \texttt{site} is the basis of all adjustments instead of the corresponding partial null-hypothesis. -Another important application are simultaneous tests for many response -variables. This problem frequently occurs in microarray expression studies -and we shall have a look at an artificial example: 100 variables (from a -normal distribution) are to be tested in a one-way classification with $n = -40$ observations. Only the first variable shows a difference and we are -interested in both a global test and the adjusted $p$-values. Here, the -example is formulated within the \pkg{Biobase} \citep{PKG:Biobase} -framework (example currently not run because of dependencies problems): -<>= -if (require("Biobase")) { - - p <- 100 - pd <- new("AnnotatedDataFrame", - data = data.frame(group = gl(2, 20)), - varMetadata = data.frame(labelDescription = "1/2")) - exprs <- matrix(rnorm(p * 40), nrow = p) - exprs[1, 1:20] <- exprs[1, 1:20] + 1.5 - ex <- new("ExpressionSet", exprs = exprs, phenoData = pd) - - it <- independence_test(group ~ ., data = ex, - distribution = approximate(B = 1000)) - - print(pvalue(it)) - print(which(pvalue(it, method = "step-down") < 0.05)) - -} -@ - \section{Quality Assurance} The test procedures implemented in package \pkg{coin} are continuously checked Binary files /tmp/tmpHnEIKV/760w9AHbfe/r-cran-coin-1.1-0/inst/doc/LegoCondInf.pdf and /tmp/tmpHnEIKV/OnhKoy0KZd/r-cran-coin-1.1-2/inst/doc/LegoCondInf.pdf differ Binary files /tmp/tmpHnEIKV/760w9AHbfe/r-cran-coin-1.1-0/inst/doc/MAXtest.pdf and /tmp/tmpHnEIKV/OnhKoy0KZd/r-cran-coin-1.1-2/inst/doc/MAXtest.pdf differ diff -Nru r-cran-coin-1.1-0/inst/NEWS.Rd r-cran-coin-1.1-2/inst/NEWS.Rd --- r-cran-coin-1.1-0/inst/NEWS.Rd 2015-08-14 13:18:12.000000000 +0000 +++ r-cran-coin-1.1-2/inst/NEWS.Rd 2015-11-16 10:05:46.000000000 +0000 @@ -1,6 +1,35 @@ \name{NEWS} \encoding{UTF-8} \title{News for Package \pkg{coin}} +\section{Changes in version 1.1-2 (2015-11-13)}{ + \subsection{Bug fixes}{ + \itemize{ + \item \code{of_trafo()} did not handle ordered factors of length one + + \item Parallel operation (via \code{approximate()}) changed the random + number generator state upon first invocation unless package + \pkg{parallel}'s namespace had already been loaded + } + } + \subsection{User-visible changes}{ + \itemize{ + \item Documentation updates + } + } +} +\section{Changes in version 1.1-1 (2015-10-25)}{ + \subsection{Bug fixes}{ + \itemize{ + \item Methods \code{initialize()} and \code{show()} were not + imported from package \pkg{methods} + } + } + \subsection{User-visible changes}{ + \itemize{ + \item Documentation and vignette updates + } + } +} \section{Changes in version 1.1-0 (2015-08-14)}{ \subsection{New features}{ \itemize{ @@ -259,7 +288,7 @@ validity } } - \subsection{Other changes}{ + \subsection{User-visible changes}{ \itemize{ \item The Pearson chi-squared test, the generalized Cochran-Mantel-Haenszel test, the linear-by-linear association test and @@ -356,7 +385,8 @@ \item The memory consumption during computations has been reduced \item Henric Winell, a long-term collaborator who donated almost all - changes in \pkg{coin} 1.1-0, is now listed as author. Welcome on board, Henric! + changes in \pkg{coin} 1.1-0, is now listed as author. Welcome on board, + Henric! } } } diff -Nru r-cran-coin-1.1-0/man/IndependenceTest.Rd r-cran-coin-1.1-2/man/IndependenceTest.Rd --- r-cran-coin-1.1-0/man/IndependenceTest.Rd 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/man/IndependenceTest.Rd 2015-10-26 11:10:59.000000000 +0000 @@ -27,12 +27,6 @@ } \item{data}{ an optional data frame containing the variables in the model formula. - Alternatively, an object of class - \code{"\link[Biobase:class.ExpressionSet]{ExpressionSet}"} (see package - \pkg{Biobase}) may be specified. In this case, all variables in - \code{formula}, except \code{.}, are first evaluated in the \code{pData} - data frame. The dot (\code{.}) refers to the matrix of expression levels - (i.e., the \code{exprs} slot). } \item{subset}{ an optional vector specifying a subset of observations to be used. Defaults diff -Nru r-cran-coin-1.1-0/man/MarginalHomogeneityTests.Rd r-cran-coin-1.1-2/man/MarginalHomogeneityTests.Rd --- r-cran-coin-1.1-0/man/MarginalHomogeneityTests.Rd 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/man/MarginalHomogeneityTests.Rd 2015-11-16 10:05:46.000000000 +0000 @@ -237,6 +237,7 @@ ## Asymptotic Madansky-Birch test (Q = 47.29) ## Note: response and measurement conditions as ordinal -mh_test(as.table(dysmenorrhea), scores = list(response = 1:3, conditions = 3:1)) +mh_test(as.table(dysmenorrhea), scores = list(response = 1:3, + conditions = 3:1)) } \keyword{htest} \ No newline at end of file diff -Nru r-cran-coin-1.1-0/man/ocarcinoma.Rd r-cran-coin-1.1-2/man/ocarcinoma.Rd --- r-cran-coin-1.1-0/man/ocarcinoma.Rd 2015-08-03 10:27:58.000000000 +0000 +++ r-cran-coin-1.1-2/man/ocarcinoma.Rd 2015-08-25 14:46:48.000000000 +0000 @@ -43,8 +43,8 @@ } \examples{ ## Exact logrank test -lt <- surv_test(Surv(time, event) ~ stadium, data = ocarcinoma, - distribution = "exact") +lt <- logrank_test(Surv(time, event) ~ stadium, data = ocarcinoma, + distribution = "exact") ## Test statistic statistic(lt) diff -Nru r-cran-coin-1.1-0/man/PermutationDistribution-methods.Rd r-cran-coin-1.1-2/man/PermutationDistribution-methods.Rd --- r-cran-coin-1.1-0/man/PermutationDistribution-methods.Rd 2015-08-03 10:27:58.000000000 +0000 +++ r-cran-coin-1.1-2/man/PermutationDistribution-methods.Rd 2015-10-26 11:10:59.000000000 +0000 @@ -81,8 +81,15 @@ numeric vector. } \note{ - In versions of \pkg{coin} prior to 1.1-0, the support of an asymptotic - permutation distribution was given as an interval containing 99.999 \% of the + The density of asymptotic permutation distributions for maximum-type tests or + exact permutation distributions obtained by the split-up algoritm is reported + as \code{NA}. The quantile function of asymptotic permutation distributions + for maximum-type tests cannot be computed for \code{p} less than 0.5, due to + limitations in the \pkg{mvtnorm} package. The support of exact permutation + distributions obtained by the split-up algorithm is reported as \code{NA}. + + In versions of \pkg{coin} prior to 1.1-0, the support of asymptotic + permutation distributions was given as an interval containing 99.999 \% of the probability mass. It is now reported as \code{NA}. } \examples{ diff -Nru r-cran-coin-1.1-0/man/pvalue-methods.Rd r-cran-coin-1.1-2/man/pvalue-methods.Rd --- r-cran-coin-1.1-0/man/pvalue-methods.Rd 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/man/pvalue-methods.Rd 2015-10-26 11:10:59.000000000 +0000 @@ -127,6 +127,10 @@ \code{object}. A numeric vector or matrix. } \note{ + The mid-\eqn{p}-value and \eqn{p}-value interval of asymptotic permutation + distributions for maximum-type tests or exact permutation distributions + obtained by the split-up algoritm is reported as \code{NA}. + In versions of \pkg{coin} prior to 1.1-0, a min-\eqn{P} procedure computing \enc{Šidák}{Sidak} single-step adjusted \eqn{p}-values accounting for discreteness was available when specifying \code{method = "discrete"}. diff -Nru r-cran-coin-1.1-0/man/SymmetryTest.Rd r-cran-coin-1.1-2/man/SymmetryTest.Rd --- r-cran-coin-1.1-0/man/SymmetryTest.Rd 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/man/SymmetryTest.Rd 2015-10-26 11:10:59.000000000 +0000 @@ -226,8 +226,8 @@ ### Asymptotic multivariate Page test (st <- symmetry_test(y1 + y2 ~ x | b, data = gerig, ytrafo = function(data) - trafo(data, numeric_trafo = rank_trafo, - block = gerig$b), + trafo(data, numeric_trafo = rank_trafo, + block = gerig$b), scores = list(x = 1:3))) pvalue(st, method = "step-down") } diff -Nru r-cran-coin-1.1-0/MD5 r-cran-coin-1.1-2/MD5 --- r-cran-coin-1.1-0/MD5 2015-08-16 06:25:28.000000000 +0000 +++ r-cran-coin-1.1-2/MD5 2015-11-16 15:20:12.000000000 +0000 @@ -1,29 +1,29 @@ -4ff0432c79630f5890ff7a69186604d1 *DESCRIPTION -9c6dab165c48cb931d99b0d7864b57d4 *NAMESPACE +4fff0b4bd6776f0c214cceb23b375b11 *DESCRIPTION +0c9f2e446d368fa83e587ba9c2c832ee *NAMESPACE 433e41930224706335fc21361baba796 *R/AAA.R 681caa9aba641f34b1afd182c7bd959e *R/Classes.R 1fb22c1b6b16d0c1929cfab72a9ba4c5 *R/Confints.R -1be1741d8fd6867ec04023c7a15d7b24 *R/ContingencyTests.R -3b0817d99ea7ce81f3637bf25b07a5b9 *R/ContrastTest.R -c9e5d5657d8c51b61417f04e661e868e *R/CorrelationTests.R +e825d127654d3348bb809b45f863bb12 *R/ContingencyTests.R +4a34fec8e5eb2539840db8ff7c9b7bf1 *R/ContrastTest.R +53c182412fc231e16fc36b6652df88e9 *R/CorrelationTests.R aadacf8a4800e9f76bba71543d2ffa5c *R/ExactDistributions.R 57b1febae97ed03ed2af70812efcb197 *R/IndependenceTest.R b70202043853887eabdcda1c1f325ea0 *R/InitMethods.R e93792d63e70e57c0edebd286514ece7 *R/LocationTests.R -6d608ec718bda2a46d9c926e30340170 *R/MTP.R +b4fe25390d5446c1c62e5852b3b140d2 *R/MTP.R b135c31345b5db3b8e765ace9250d620 *R/MarginalHomogeneityTests.R -2d7e57ccdb0d6efe2bcf1dbc6b969c41 *R/MaximallySelectedStatisticsTests.R +b8511c4392ac20e502bffb4254f27b68 *R/MaximallySelectedStatisticsTests.R 53520a229b57334302ed60a3ceef7bfd *R/Methods.R -886cb36e7924cfa08c8cc4bde1e4c0a3 *R/MonteCarloDistributions.R +259e80c0f88136f61fb1520341ceae3e *R/MonteCarloDistributions.R 1ce1b542e179494c7d7513628c04cf52 *R/Print.R b94b539f42f2653b4c4efeeb07f185c0 *R/ScaleTests.R 60bd857f377e63b7f062d7b484d63751 *R/SurvivalTests.R 12be11f26182075b49922dc858cf2d60 *R/SymmetryTest.R e480d90ac7f757478761fcd5c006a0ba *R/SymmetryTests.R -9614c0558cc68e4154569c99704b2206 *R/Transformations.R -878b4760e4c9adda8599525897044126 *R/helpers.R +f4637fb72ec282384440dd2995a18216 *R/Transformations.R +4fc524ea9cd6d06aa0ccb0e9a07c6f59 *R/helpers.R b96382cf53da7509a04a4593f5a93752 *R/zAccess.R -b45026d380a41715ddb88d754140b277 *build/vignette.rds +757245231d56407bca5f75e860cd05e2 *build/vignette.rds 339c2c619522533780dc2ab641fef27d *cleanup 830c477eb44396118743a53d55562e81 *data/CWD.rda 1777707713135c76b7bb4caa7c2eb628 *data/GTSG.rda @@ -42,19 +42,19 @@ 1e5912e43e0c446c38983172d8983e5a *data/treepipit.rda bb0e6c19f2bd41548010ec3112686a7d *data/vision.rda f5b1c797ee755bd1d03a10f60211d3d0 *inst/CITATION -912b6284cfe760d4c6bb38d1752e2f9b *inst/NEWS.Rd +b9da12c1f35b5427f9caa12bfa8edc99 *inst/NEWS.Rd 16c0c097de5c5b9d40f2ed41cc1e26ea *inst/doc/LegoCondInf.R 6ef7ed0319c193d02f3c2a330fb185bc *inst/doc/LegoCondInf.Rnw -4a23f739db951b2cd48c3fcb024ddca2 *inst/doc/LegoCondInf.pdf +159dde3a8d82cc0750fce86e7e7acc21 *inst/doc/LegoCondInf.pdf af3d799e35001f7449724878b2e64e10 *inst/doc/MAXtest.R b22a9e7891f3b2556fc4b901cf4bc5c0 *inst/doc/MAXtest.Rnw -72f453c830db4af5943df554beaf61d8 *inst/doc/MAXtest.pdf -7df5c98927f46058989078411f99a088 *inst/doc/coin.R -d0f3d7d8876d9fb64cc8033b62add726 *inst/doc/coin.Rnw -3aa3c7348080f311fdf8fb6e49af85d0 *inst/doc/coin.pdf +6ae49eea2aae0e0f075c4797ce87531a *inst/doc/MAXtest.pdf +7b0115a330e648e3e54d420783fd9bc0 *inst/doc/coin.R +24ff5301be1b74f21a09a56b7732994c *inst/doc/coin.Rnw +e8681ce9942e5d2c994e0ff9c1537500 *inst/doc/coin.pdf 59839f4efc26e3f880fe358c51fa75b8 *inst/doc/coin_implementation.R bcb0a664042e4afd459b9d64861daf6b *inst/doc/coin_implementation.Rnw -aff44583e952876ac50c9afdee7b1fc6 *inst/doc/coin_implementation.pdf +0bcfc10f7f776377ed4011c253589ce2 *inst/doc/coin_implementation.pdf 156ef07bec63211d3fae2239bf4c08df *inst/doxygen.cfg 9e10d4d060c65a5efb4e0329de482b1b *man/CWD.Rd 2dd4f3e1e71c2b7bd9ffd259c2faf8d8 *man/ContingencyTests.Rd @@ -65,21 +65,21 @@ e9e4fbb6dad4b728d465c0adbd61b80c *man/IndependenceLinearStatistic-class.Rd ab4901f9389e4fef6859ede571c8beaf *man/IndependenceProblem-class.Rd 7880977a0ae999abca14f6bee27c8774 *man/IndependenceTest-class.Rd -7576bd4f2b6eaab2110ede4111bfe8e8 *man/IndependenceTest.Rd +6deaedcffdf0274c2455f44d6b37776b *man/IndependenceTest.Rd ec24b1f79595023462bdebd19905d875 *man/IndependenceTestProblem-class.Rd 1cdb95f867e231d286e5e31138c6fbc7 *man/IndependenceTestStatistic-class.Rd 7c48b28dedcbab31e200116ec8af6ae7 *man/LocationTests.Rd -15c9c1aa7eeddfcacb78dee01dd79d01 *man/MarginalHomogeneityTests.Rd +08f3b94bda3fc985c4b0d9738c6002bf *man/MarginalHomogeneityTests.Rd dc612ffc273f4192cde966b7575056ef *man/MaximallySelectedStatisticsTests.Rd d2e424da206c9fe9352f17801a67af5f *man/NullDistribution-class.Rd e156b3f44fec022b6cec121bff587c61 *man/NullDistribution-methods.Rd 8a48dae95b71a539612b71e7a82f90e3 *man/NullDistribution.Rd b405a5432268db22938cbe699455aaea *man/PValue-class.Rd -ce73a3d0b2faa23ad386f1d2e187f8ad *man/PermutationDistribution-methods.Rd +5080d5221a0e5b733d36974896adfc6d *man/PermutationDistribution-methods.Rd 36448c511c7d8cba2cdb1a89075e7285 *man/ScaleTests.Rd b91007df1570b4e19a47ae140a6a3e83 *man/SurvivalTests.Rd 61c1e2a0f5af9c13150e7951a4ad3290 *man/SymmetryProblem-class.Rd -46527675cc139c5bcc9b83ed85ccc602 *man/SymmetryTest.Rd +43fccf4f21e852fe11860a630e3d7e8f *man/SymmetryTest.Rd 90ddc57014b98324bfaf126dbdc73963 *man/SymmetryTests.Rd 7fcae4449ba45549ed8c0365ac522a07 *man/Transformations.Rd 8d52d23f90ac390436c6a6cb016cac8d *man/VarCovar-class.Rd @@ -94,9 +94,9 @@ 9459ea0824581e1cfb90e7307a3a10cf *man/malformations.Rd 7b44ea0dca57148e1af5c7b95600a088 *man/mercuryfish.Rd cf636e17bb943823af3c12433d5c2e0b *man/neuropathy.Rd -b7535f71af0d22ffc27a92e2959bedac *man/ocarcinoma.Rd +d26de35e0f76393a5ee867223b97fe51 *man/ocarcinoma.Rd d3f02e9fd2b084d7f3fc971f169ff3d9 *man/photocar.Rd -0753190e25cc0d2c0cf135ad1de109af *man/pvalue-methods.Rd +01be45bcb5527bcabdefa2d5d802f866 *man/pvalue-methods.Rd 1d8986d3cc52b702192997047352b07b *man/rotarod.Rd a7d41db7a96a38d93f8766dcdb8eb20c *man/statistic-methods.Rd 2cab2b9ab59984ad9cbfb0d60a0b2c1e *man/treepipit.Rd @@ -112,14 +112,14 @@ 0f677a82d1683391a2658ef113cc8821 *src/coin_common.h b875a243516cc3d855be505301818e0f *src/vandeWiel.c e0b792dbddaed545aff2c18dc98ad809 *tests/AIDS.rda -94556640ada4a02d6f18900b17276dd6 *tests/Examples/coin-Ex.Rout.save +5d2abd775e10425ba8ae229167783a4a *tests/Examples/coin-Ex.Rout.save 5b1b1dc49df4197484d81e29f8cbd791 *tests/FAILURE.rda 2db934fd5eeb9337b25b6b7ee987b7f2 *tests/LANCET.rda 2fd67ce29043f1d5f297df712761805e *tests/army.rda 4481dedb450b1420b672fcaec2839303 *tests/asthma.rda 20c2feaf3c032f2e7ef166725171d7ea *tests/bloodp.rda -5091800f173a82ae5455b3bb023b0f74 *tests/bugfixes.R -805884df1e36ec897e427627c0cda024 *tests/bugfixes.Rout.save +ea23797893cd5db72327161f4beb78d8 *tests/bugfixes.R +e0ad7b56e32133583cfa32be2612a06d *tests/bugfixes.Rout.save 961e0554906015572bb45699340c372e *tests/comparisons.R 5b69eda51c1a9cddec015e94a7cd49ff *tests/comparisons.Rout.save 97b4cab405919df260d401c18df54ccf *tests/employment.rda @@ -130,12 +130,12 @@ f2efb0424360404c7ec5a1fd21769db8 *tests/regtest_Ksample.Rout.save aaaa53d4abb8ea210dd6b221b2d49924 *tests/regtest_MTP.R 135d5c7854623693b3be7d43aff179d7 *tests/regtest_MTP.Rout.save -cd74d6cbedbfeaf09a81173fd9e77a02 *tests/regtest_contingency.R -2f4854ae7af811ab6cd3bb238b1fa6f4 *tests/regtest_contingency.Rout.save +4c490647dc92d21a245d4dc48e001bee *tests/regtest_contingency.R +3c4aa9a28675dad230d1ccefa9a91042 *tests/regtest_contingency.Rout.save f6af0df51a8c415520d0faaa4de720f7 *tests/regtest_correlation.R fe0187e650dd608df8bfc04904cccd25 *tests/regtest_correlation.Rout.save -8309b51bfd74e8b6b4acbeceb2dc2aba *tests/regtest_distribution.R -42d098fb38c0c1f657115ef2c1309398 *tests/regtest_distribution.Rout.save +8e5b05a25bc98a1d021faa542ccd8515 *tests/regtest_distribution.R +2f34dc4db974f486c04e02e172609ab5 *tests/regtest_distribution.Rout.save 38960ec31cdc2c09065b6d1ad2a13961 *tests/regtest_helpers.R 18cbc33126da4446fbcf26e02f0d1d74 *tests/regtest_helpers.Rout.save 7d2ff8b89b34ebdd0c4e0b75ef84da83 *tests/regtest_midpvalue.R @@ -147,8 +147,8 @@ 20f72c411c23b0b8ff6b414180273f41 *vignettes/LegoCondInf.bib b22a9e7891f3b2556fc4b901cf4bc5c0 *vignettes/MAXtest.Rnw 948ef4ce027fcc640eb4cda19a969794 *vignettes/MAXtest.Rout.save -d0f3d7d8876d9fb64cc8033b62add726 *vignettes/coin.Rnw -e00d003978429b159a524e31187d8a3e *vignettes/coin.Rout.save +24ff5301be1b74f21a09a56b7732994c *vignettes/coin.Rnw +a53875aed6e4fbd3f051ce8352625361 *vignettes/coin.Rout.save 42fd0e4e13ada4971acfbaba44e480d9 *vignettes/coin.bib bcb0a664042e4afd459b9d64861daf6b *vignettes/coin_implementation.Rnw 87c644bfac188721213c47424b006b1a *vignettes/coin_implementation.Rout.save diff -Nru r-cran-coin-1.1-0/NAMESPACE r-cran-coin-1.1-2/NAMESPACE --- r-cran-coin-1.1-0/NAMESPACE 2015-07-21 14:42:48.000000000 +0000 +++ r-cran-coin-1.1-2/NAMESPACE 2015-08-31 13:56:27.000000000 +0000 @@ -1,12 +1,13 @@ useDynLib(coin) importFrom("methods", callNextMethod, extends, getSlots, new, validObject) +importMethodsFrom("methods", initialize, show) importFrom("survival", is.Surv) importFrom("stats", complete.cases, confint, cov2cor, dchisq, dnorm, median, model.frame, model.matrix, na.pass, pbinom, pchisq, pnorm, qbeta, qchisq, qnorm, quantile, runif, setNames, uniroot) -importMethodsFrom("modeltools", has, na.omit) importFrom("modeltools", ModelEnvFormula) +importMethodsFrom("modeltools", has, na.omit) importFrom("mvtnorm", pmvnorm, qmvnorm) importFrom("multcomp", contrMat) diff -Nru r-cran-coin-1.1-0/R/ContingencyTests.R r-cran-coin-1.1-2/R/ContingencyTests.R --- r-cran-coin-1.1-0/R/ContingencyTests.R 2015-08-06 09:53:01.000000000 +0000 +++ r-cran-coin-1.1-2/R/ContingencyTests.R 2015-10-26 11:10:59.000000000 +0000 @@ -176,8 +176,9 @@ args <- setup_args( teststat = "scalar", - distribution = check_distribution_arg(distribution, - match.arg(distribution)), + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate", "none") + ), check = function(object) { if (!is_doubly_ordered(object)) stop(sQuote("object"), diff -Nru r-cran-coin-1.1-0/R/ContrastTest.R r-cran-coin-1.1-2/R/ContrastTest.R --- r-cran-coin-1.1-0/R/ContrastTest.R 2015-08-06 09:53:01.000000000 +0000 +++ r-cran-coin-1.1-2/R/ContrastTest.R 2015-10-26 11:10:59.000000000 +0000 @@ -21,12 +21,11 @@ if (is.null(colnames(cmatrix))) colnames(cmatrix) <- paste0("C", 1:ncol(cmatrix)) - distribution <- check_distribution_arg(distribution, - values = c("asymptotic", "approximate")) - args <- setup_args( teststat = "maximum", - distribution = distribution, + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate") + ), xtrafo = function(data) trafo(data) %*% cmatrix ) diff -Nru r-cran-coin-1.1-0/R/CorrelationTests.R r-cran-coin-1.1-2/R/CorrelationTests.R --- r-cran-coin-1.1-0/R/CorrelationTests.R 2015-08-06 09:53:01.000000000 +0000 +++ r-cran-coin-1.1-2/R/CorrelationTests.R 2015-10-26 11:10:59.000000000 +0000 @@ -13,8 +13,9 @@ args <- setup_args( teststat = "scalar", - distribution = check_distribution_arg(distribution, - match.arg(distribution)), + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate", "none") + ), xtrafo = function(data) trafo(data, numeric_trafo = rank_trafo), ytrafo = function(data) @@ -53,8 +54,9 @@ args <- setup_args( teststat = "scalar", - distribution = check_distribution_arg(distribution, - match.arg(distribution)), + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate", "none") + ), xtrafo = function(data) trafo(data, numeric_trafo = function(x) normal_trafo(x, ties.method = ties.method)), @@ -98,8 +100,9 @@ args <- setup_args( teststat = "scalar", - distribution = check_distribution_arg(distribution, - match.arg(distribution)), + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate", "none") + ), xtrafo = function(data) trafo(data, numeric_trafo = function(x) median_trafo(x, mid.score = mid.score)), @@ -140,8 +143,9 @@ args <- setup_args( teststat = "scalar", - distribution = check_distribution_arg(distribution, - match.arg(distribution)), + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate", "none") + ), xtrafo = function(data) trafo(data, numeric_trafo = function(x) koziol_trafo(x, ties.method = ties.method)), diff -Nru r-cran-coin-1.1-0/R/helpers.R r-cran-coin-1.1-2/R/helpers.R --- r-cran-coin-1.1-0/R/helpers.R 2015-08-06 09:53:01.000000000 +0000 +++ r-cran-coin-1.1-2/R/helpers.R 2015-11-16 10:05:46.000000000 +0000 @@ -154,35 +154,23 @@ "quadrant_test", "koziol_test") formula2data <- function(formula, data, subset, weights = NULL, ...) { + no_weights <- is.null(weights) - other <- list() - if (!is.null(weights)) other = list(weights = weights) - - ## in case `data' is an ExpressionSet object - if (extends(class(data), "ExpressionSet")) { - dat <- ModelEnvFormula(formula = formula, - data = Biobase::pData(Biobase::phenoData(data)), - subset = subset, other = other, - designMatrix = FALSE, responseMatrix = FALSE, - na.action = na.omit, - ...) - - ## x are _all_ expression levels, always - x <- as.data.frame(t(Biobase::exprs(data))) - } else { - dat <- ModelEnvFormula(formula = formula, - data = data, - subset = subset, other = other, - na.action = na.omit, - designMatrix = FALSE, responseMatrix = FALSE, - ...) - - ## rhs of formula - if (has(dat, "input")) - x <- dat@get("input") - else - stop("missing right hand side of formula") - } + dat <- ModelEnvFormula( + formula = formula, + data = data, + subset = subset, + other = if (no_weights) list() else list(weights = weights), + na.action = na.omit, + designMatrix = FALSE, responseMatrix = FALSE, + ... + ) + + ## rhs of formula + if (has(dat, "input")) + x <- dat@get("input") + else + stop("missing right hand side of formula") ## ~ x + y is allowed if (has(dat, "response")) @@ -202,11 +190,8 @@ } else block <- NULL - RET <- list(x = x, y = y, block = block, bl = block[[1L]], w = NULL) - if (!is.null(weights)) - RET$w <- dat@get("weights")[[1L]] - - return(RET) + list(x = x, y = y, block = block, bl = block[[1L]], + w = if (no_weights) NULL else dat@get("weights")[[1L]]) } setscores <- function(x, scores) { @@ -410,7 +395,7 @@ check_distribution_arg <- function(distribution, values = c("asymptotic", "approximate", "exact", "none")) { if (is.character(distribution)) { - distribution <- match.arg(distribution[1], values) + distribution <- match.arg(distribution, values) if (distribution == "none") function(object) new("NullDistribution") else @@ -521,6 +506,11 @@ is_unity <- function(x) max(abs(x - 1.0)) < eps() +setRownames <- function (object, nm) { + rownames(object) <- nm + object +} + setColnames <- function (object, nm) { colnames(object) <- nm object diff -Nru r-cran-coin-1.1-0/R/MaximallySelectedStatisticsTests.R r-cran-coin-1.1-2/R/MaximallySelectedStatisticsTests.R --- r-cran-coin-1.1-0/R/MaximallySelectedStatisticsTests.R 2015-08-06 09:53:01.000000000 +0000 +++ r-cran-coin-1.1-2/R/MaximallySelectedStatisticsTests.R 2015-10-26 11:10:59.000000000 +0000 @@ -22,8 +22,9 @@ args <- setup_args( teststat = match.arg(teststat), - distribution = check_distribution_arg(distribution, - match.arg(distribution)), + distribution = check_distribution_arg( + distribution, values = c("asymptotic", "approximate", "none") + ), xtrafo = function(data) trafo(data, numeric_trafo = function(x) diff -Nru r-cran-coin-1.1-0/R/MonteCarloDistributions.R r-cran-coin-1.1-2/R/MonteCarloDistributions.R --- r-cran-coin-1.1-0/R/MonteCarloDistributions.R 2015-07-01 12:45:50.000000000 +0000 +++ r-cran-coin-1.1-2/R/MonteCarloDistributions.R 2015-11-16 10:05:46.000000000 +0000 @@ -22,7 +22,7 @@ montecarlo(B) else { ## load the 'parallel' namespace if necessary - if (isNamespaceLoaded("parallel")) { + if (!isNamespaceLoaded("parallel")) { ## loading 'parallel' changes RNG state if R_PARALLEL_PORT is unset if (Sys.getenv("R_PARALLEL_PORT") == "") { ## make sure '.Random.seed' exists; almost unnecessary since it diff -Nru r-cran-coin-1.1-0/R/MTP.R r-cran-coin-1.1-2/R/MTP.R --- r-cran-coin-1.1-0/R/MTP.R 2014-09-16 12:33:33.000000000 +0000 +++ r-cran-coin-1.1-2/R/MTP.R 2015-10-26 11:10:59.000000000 +0000 @@ -227,9 +227,6 @@ ## it is currently hard to ask a distribution object ## for its type (and arguments). Its a design bug. distribution <- object@call$distribution - ## use default value - if (is.null(distribution)) - distribution <- eval(formals(eval(object@call[[1]]))$distribution)[1] ## stand_tstat <- statistic(object, type = "standardized") tstat <- switch(alternative, diff -Nru r-cran-coin-1.1-0/R/Transformations.R r-cran-coin-1.1-2/R/Transformations.R --- r-cran-coin-1.1-0/R/Transformations.R 2015-08-06 09:53:01.000000000 +0000 +++ r-cran-coin-1.1-2/R/Transformations.R 2015-11-16 10:05:46.000000000 +0000 @@ -407,10 +407,9 @@ if (!is.ordered(x)) warning(sQuote(deparse(substitute(x))), " is not an ordered factor") if (is.null(scores)) { - s <- attr(x, "scores") scores <- if (nlevels(x) == 2L) 0:1 # must be 0:1 for exact p-values - else if (!is.null(s)) + else if (!is.null(s <- attr(x, "scores"))) s else seq_len(nlevels(x)) @@ -418,9 +417,7 @@ if (!is.list(scores)) scores <- list(scores) if (all(lengths(scores) == nlevels(x))) - structure(vapply(scores, FUN = function(s) s[x], as.double(x), - USE.NAMES = FALSE), - dimnames = list(seq_along(x), names(scores))) + setRownames(do.call("cbind", scores)[x, , drop = FALSE], seq_along(x)) else stop(sQuote("scores"), " does not match the number of levels") } diff -Nru r-cran-coin-1.1-0/tests/bugfixes.R r-cran-coin-1.1-2/tests/bugfixes.R --- r-cran-coin-1.1-0/tests/bugfixes.R 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/tests/bugfixes.R 2015-11-16 10:05:46.000000000 +0000 @@ -585,3 +585,6 @@ stopifnot(identical(pvalue(it5), pvalue(it6))) stopifnot(identical(pvalue(it5), pvalue(it7))) stopifnot(identical(pvalue(it5), pvalue(it8))) + +### 'of_trafo' threw an error for 'x' of length one +of_trafo(gl(3, 1, ordered = TRUE)[1]) diff -Nru r-cran-coin-1.1-0/tests/bugfixes.Rout.save r-cran-coin-1.1-2/tests/bugfixes.Rout.save --- r-cran-coin-1.1-0/tests/bugfixes.Rout.save 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/tests/bugfixes.Rout.save 2015-11-16 10:05:46.000000000 +0000 @@ -1,5 +1,5 @@ -R Under development (unstable) (2015-07-24 r68738) -- "Unsuffered Consequences" +R Under development (unstable) (2015-10-20 r69547) -- "Unsuffered Consequences" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) @@ -977,6 +977,11 @@ > stopifnot(identical(pvalue(it5), pvalue(it7))) > stopifnot(identical(pvalue(it5), pvalue(it8))) > +> ### 'of_trafo' threw an error for 'x' of length one +> of_trafo(gl(3, 1, ordered = TRUE)[1]) + [,1] +1 1 +> > proc.time() user system elapsed - 2.57 0.20 2.80 + 2.93 0.26 4.04 diff -Nru r-cran-coin-1.1-0/tests/Examples/coin-Ex.Rout.save r-cran-coin-1.1-2/tests/Examples/coin-Ex.Rout.save --- r-cran-coin-1.1-0/tests/Examples/coin-Ex.Rout.save 2015-08-06 09:53:02.000000000 +0000 +++ r-cran-coin-1.1-2/tests/Examples/coin-Ex.Rout.save 2015-11-16 10:14:14.000000000 +0000 @@ -1,5 +1,5 @@ -R Under development (unstable) (2015-07-24 r68738) -- "Unsuffered Consequences" +R Under development (unstable) (2015-10-20 r69547) -- "Unsuffered Consequences" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) @@ -20,7 +20,6 @@ > pkgname <- "coin" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) -> options(pager = "console") > library('coin') Loading required package: survival > @@ -1027,7 +1026,8 @@ > > ## Asymptotic Madansky-Birch test (Q = 47.29) > ## Note: response and measurement conditions as ordinal -> mh_test(as.table(dysmenorrhea), scores = list(response = 1:3, conditions = 3:1)) +> mh_test(as.table(dysmenorrhea), scores = list(response = 1:3, ++ conditions = 3:1)) Asymptotic Marginal Homogeneity Test for Ordered Data @@ -1574,8 +1574,8 @@ > ### Asymptotic multivariate Page test > (st <- symmetry_test(y1 + y2 ~ x | b, data = gerig, + ytrafo = function(data) -+ trafo(data, numeric_trafo = rank_trafo, -+ block = gerig$b), ++ trafo(data, numeric_trafo = rank_trafo, ++ block = gerig$b), + scores = list(x = 1:3))) Asymptotic General Symmetry Test @@ -2625,9 +2625,8 @@ > ### ** Examples > > ## Exact logrank test -> lt <- surv_test(Surv(time, event) ~ stadium, data = ocarcinoma, -+ distribution = "exact") -Warning: 'surv_test' is deprecated. Use 'logrank_test' instead. +> lt <- logrank_test(Surv(time, event) ~ stadium, data = ocarcinoma, ++ distribution = "exact") > > ## Test statistic > statistic(lt) @@ -2986,7 +2985,7 @@ > ### > options(digits = 7L) > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n") -Time elapsed: 15.68 0.23 15.97 NA NA +Time elapsed: 15.3 0.23 15.61 NA NA > grDevices::dev.off() null device 1 diff -Nru r-cran-coin-1.1-0/tests/regtest_contingency.R r-cran-coin-1.1-2/tests/regtest_contingency.R --- r-cran-coin-1.1-0/tests/regtest_contingency.R 2013-09-02 08:29:26.000000000 +0000 +++ r-cran-coin-1.1-2/tests/regtest_contingency.R 2015-08-25 14:46:48.000000000 +0000 @@ -1,4 +1,3 @@ - ### Regression tests for the r x c x K problem, i.e., ### testing the independence of a factor ### `y' and a factor factor `x' (possibly blocked) @@ -8,7 +7,6 @@ isequal <- coin:::isequal options(useFancyQuotes = FALSE) -thisversion <- paste(R.version$major, R.version$minor, sep = ".") ### generate data: 2 x 2 x K dat <- data.frame(x = gl(2, 50), y = gl(2, 50)[sample(1:100)], @@ -33,28 +31,26 @@ block = gl(2, 50)[sample(1:100)]) ### Cochran-Mantel-Haenzel Test, asymptotic distribution -### _is wrong_ in R < 2.1.0!!! +### (was wrong in R < 2.1.0) ptwo <- drop(mantelhaen.test(table(dat$y, dat$x, dat$block), correct = FALSE)$p.value) -if (compareVersion(thisversion, "2.1.0") >= 0) { - stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) - stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) -} +stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) +stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) + ### generate data: r x c x K dat <- data.frame(x = gl(4, 25), y = gl(5, 20)[sample(1:100)], block = gl(2, 50)[sample(1:100)]) ### Cochran-Mantel-Haenzel Test, asymptotic distribution -### _is wrong_!!! +### (was wrong in R < 2.1.0) ptwo <- drop(mantelhaen.test(table(dat$y, dat$x, dat$block), correct = FALSE)$p.value) -if (compareVersion(thisversion, "2.1.0") >= 0) { - stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) - stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) -} +stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) +stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) + ### 2x2 table and maxstat x <- c(rep(1,51), rep(2,49)) @@ -62,6 +58,7 @@ stopifnot(isequal(as.vector(statistic(independence_test(table(x, y)))), as.vector(statistic(maxstat_test(y ~ x ))))) + ### maxstat for multiple, ordered and unordered covariates dat <- data.frame(w = rnorm(100), x = runif(100), y = gl(4, 25)[sample(1:100)], z = ordered(gl(4, 25)[sample(1:100)])) @@ -98,6 +95,7 @@ stopifnot(isequal(statistic(mt), abs(statistic(independence_test(w ~ xx, data = dat))))) + ### marginal homogeneity rating <- c("low", "moderate", "high") x <- as.table(matrix(c(20, 10, 5, @@ -108,6 +106,3 @@ ### test statistic W_0 = 13.76 ### see http://ourworld.compuserve.com/homepages/jsuebersax/mcnemar.htm stopifnot(all.equal(round(statistic(mh_test(x)), 2), 13.76)) - - -### see `comparison.R' for more regression tests diff -Nru r-cran-coin-1.1-0/tests/regtest_contingency.Rout.save r-cran-coin-1.1-2/tests/regtest_contingency.Rout.save --- r-cran-coin-1.1-0/tests/regtest_contingency.Rout.save 2015-07-01 12:45:51.000000000 +0000 +++ r-cran-coin-1.1-2/tests/regtest_contingency.Rout.save 2015-08-25 14:46:48.000000000 +0000 @@ -1,5 +1,5 @@ -R Under development (unstable) (2015-05-13 r68364) -- "Unsuffered Consequences" +R Under development (unstable) (2015-08-13 r69049) -- "Unsuffered Consequences" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) @@ -15,7 +15,6 @@ 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. -> > ### Regression tests for the r x c x K problem, i.e., > ### testing the independence of a factor > ### `y' and a factor factor `x' (possibly blocked) @@ -26,7 +25,6 @@ > isequal <- coin:::isequal > options(useFancyQuotes = FALSE) > -> thisversion <- paste(R.version$major, R.version$minor, sep = ".") > > ### generate data: 2 x 2 x K > dat <- data.frame(x = gl(2, 50), y = gl(2, 50)[sample(1:100)], @@ -51,28 +49,26 @@ + block = gl(2, 50)[sample(1:100)]) > > ### Cochran-Mantel-Haenzel Test, asymptotic distribution -> ### _is wrong_ in R < 2.1.0!!! +> ### (was wrong in R < 2.1.0) > ptwo <- drop(mantelhaen.test(table(dat$y, dat$x, dat$block), + correct = FALSE)$p.value) > -> if (compareVersion(thisversion, "2.1.0") >= 0) { -+ stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) -+ stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) -+ } +> stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) +> stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) +> > > ### generate data: r x c x K > dat <- data.frame(x = gl(4, 25), y = gl(5, 20)[sample(1:100)], + block = gl(2, 50)[sample(1:100)]) > > ### Cochran-Mantel-Haenzel Test, asymptotic distribution -> ### _is wrong_!!! +> ### (was wrong in R < 2.1.0) > ptwo <- drop(mantelhaen.test(table(dat$y, dat$x, dat$block), + correct = FALSE)$p.value) > -> if (compareVersion(thisversion, "2.1.0") >= 0) { -+ stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) -+ stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) -+ } +> stopifnot(isequal(pvalue(cmh_test(y ~ x | block, data = dat)), ptwo)) +> stopifnot(isequal(pvalue(cmh_test(table(dat$y, dat$x, dat$block))), ptwo)) +> > > ### 2x2 table and maxstat > x <- c(rep(1,51), rep(2,49)) @@ -80,6 +76,7 @@ > stopifnot(isequal(as.vector(statistic(independence_test(table(x, y)))), + as.vector(statistic(maxstat_test(y ~ x ))))) > +> > ### maxstat for multiple, ordered and unordered covariates > dat <- data.frame(w = rnorm(100), x = runif(100), y = gl(4, 25)[sample(1:100)], + z = ordered(gl(4, 25)[sample(1:100)])) @@ -153,6 +150,7 @@ > stopifnot(isequal(statistic(mt), + abs(statistic(independence_test(w ~ xx, data = dat))))) > +> > ### marginal homogeneity > rating <- c("low", "moderate", "high") > x <- as.table(matrix(c(20, 10, 5, @@ -164,9 +162,6 @@ > ### see http://ourworld.compuserve.com/homepages/jsuebersax/mcnemar.htm > stopifnot(all.equal(round(statistic(mh_test(x)), 2), 13.76)) > -> -> ### see `comparison.R' for more regression tests -> > proc.time() user system elapsed - 2.30 0.01 2.34 + 2.26 0.10 2.49 diff -Nru r-cran-coin-1.1-0/tests/regtest_distribution.R r-cran-coin-1.1-2/tests/regtest_distribution.R --- r-cran-coin-1.1-0/tests/regtest_distribution.R 2014-11-12 12:29:38.000000000 +0000 +++ r-cran-coin-1.1-2/tests/regtest_distribution.R 2015-10-26 11:10:59.000000000 +0000 @@ -219,7 +219,9 @@ ### should be equal stopifnot(isequal(pp_it1_SR, pp_it1_vdW)) -stopifnot(isequal(qp_it1_SR[-c(1, 101)], qp_it1_vdW[-c(1, 101)])) +## Doesn't pass under Solaris or Linux w/o long doubles +## stopifnot(isequal(qp_it1_SR[-c(1, 101)], qp_it1_vdW[-c(1, 101)])) +## stopifnot(isequal(pvalue(it1_SR), pvalue(it1_vdW))) ### shift with block diff -Nru r-cran-coin-1.1-0/tests/regtest_distribution.Rout.save r-cran-coin-1.1-2/tests/regtest_distribution.Rout.save --- r-cran-coin-1.1-0/tests/regtest_distribution.Rout.save 2015-08-03 10:27:57.000000000 +0000 +++ r-cran-coin-1.1-2/tests/regtest_distribution.Rout.save 2015-10-26 11:10:59.000000000 +0000 @@ -1,5 +1,5 @@ -R Under development (unstable) (2015-07-12 r68650) -- "Unsuffered Consequences" +R Under development (unstable) (2015-09-14 r69384) -- "Unsuffered Consequences" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) @@ -2086,7 +2086,9 @@ > > ### should be equal > stopifnot(isequal(pp_it1_SR, pp_it1_vdW)) -> stopifnot(isequal(qp_it1_SR[-c(1, 101)], qp_it1_vdW[-c(1, 101)])) +> ## Doesn't pass under Solaris or Linux w/o long doubles +> ## stopifnot(isequal(qp_it1_SR[-c(1, 101)], qp_it1_vdW[-c(1, 101)])) +> ## > stopifnot(isequal(pvalue(it1_SR), pvalue(it1_vdW))) > > ### shift with block @@ -2578,4 +2580,4 @@ > > proc.time() user system elapsed - 7.30 0.78 8.12 + 4.97 0.51 5.64 diff -Nru r-cran-coin-1.1-0/vignettes/coin.Rnw r-cran-coin-1.1-2/vignettes/coin.Rnw --- r-cran-coin-1.1-0/vignettes/coin.Rnw 2014-09-16 12:33:33.000000000 +0000 +++ r-cran-coin-1.1-2/vignettes/coin.Rnw 2015-10-26 11:10:59.000000000 +0000 @@ -1,4 +1,5 @@ -\documentclass[letter]{article} +\documentclass[a4paper]{article} +\usepackage[a4paper]{geometry} \usepackage{amstext} \usepackage{amsfonts} \usepackage{hyperref} @@ -12,7 +13,7 @@ \SweaveOpts{engine=R, eps=FALSE, keep.source = TRUE} %%\VignetteIndexEntry{coin: A Computational Framework for Conditional Inference} -%%\VignetteDepends{coin,multcomp} +%%\VignetteDepends{coin} \input{head} @@ -33,7 +34,8 @@ \begin{document} -\title{\pkg{coin}: A Computational Framework for Conditional Inference} +\title{\pkg{coin}: A Computational Framework for \\ + Conditional Inference} \author{Torsten Hothorn$^1$, Kurt Hornik$^2$, Mark van de Wiel$^3$ \\ and Achim Zeileis$^2$} \date{} @@ -60,65 +62,86 @@ <>= options(width = 60) require("coin") -require("Biobase") -require("multcomp") set.seed(290875) @ \section{Introduction} -The \pkg{coin} package implements a unified approach for conditional +The \pkg{coin} package provides a unified approach to conditional inference procedures commonly known as \textit{permutation tests}. -The theoretical basis of design and implementation is the unified -framework for permutation tests given by \cite{strasserweber1999}. For a +The theoretical basis for the design and implementation is the general +framework for permutation tests given by \cite{strasserweber1999}. For a very flexible formulation of multivariate linear statistics, \cite{strasserweber1999} derived the conditional expectation and covariance of the conditional (permutation) distribution as well as the multivariate -limiting distribution. For a more detailed overview see \cite{Hothorn:2006:AmStat}. +limiting distribution. Test procedures for nominal, ordinal and continuous data +with or without censoring are all part of this framework. For a more detailed +overview see \cite{Hothorn:2006:AmStat}. + +The conceptual Strasser-Weber framework of permutation tests +for arbitrary independence and symmetry problems are available via the generic +functions \texttt{independence\_test} and \texttt{symmetry\_test} respectively. +In addition to these very flexible procedures, a large set of convenience +functions including well-known as well as lesser-known classical and +non-classical procedures for tests of independence between two continuous +variables, two- and $K$-sample tests for location and scale alternatives, tests +of independence for contingency tables as well as tests of marginal homogeneity +and symmetry have been implemented within the framework. Currently, the +following conditional test procedures are available: -Conditional counterparts of a large amount of classical (unconditional) -test procedures for -continuous, categorical and censored data are part of this framework, for -example the Cochran-Mantel-Haenszel test for independence in general -contingency tables, linear association tests for ordered categorical -data, linear rank tests and multivariate permutation tests. - -The conceptual framework of permutation tests by \cite{strasserweber1999} -for arbitrary problems is available via the generic -\texttt{independence\_test}. Because convenience functions for the most -prominent problems are available, users will not have to use this -extremely flexible procedure. Currently, the conditional variants of the -following test procedures are available: \begin{center} -\begin{tabular}{ll} -\texttt{oneway\_test} & two- and $K$-sample permutation test \\ -\texttt{wilcox\_test} & Wilcoxon-Mann-Whitney test \\ -\texttt{normal\_test} & van der Waerden normal quantile test \\ -\texttt{median\_test} & median test \\ -\texttt{kruskal\_test} & Kruskal-Wallis test \\ -\texttt{ansari\_test} & Ansari-Bradley test \\ -\texttt{fligner\_test} & Fligner-Killeen test \\ -\texttt{chisq\_test} & Pearson's $\chi^2$ test \\ -\texttt{cmh\_test} & Cochran-Mantel-Haenszel test \\ -\texttt{lbl\_test} & linear-by-linear association test \\ -\texttt{surv\_test} & two- and $K$-sample logrank test \\ -\texttt{maxstat\_test} & generalized maximally selected statistics \\ -\texttt{spearman\_test} & Spearman's test \\ -\texttt{friedman\_test} & Friedman test \\ -\texttt{wilcoxsign\_test} & Wilcoxon signed-rank test \\ -\texttt{mh\_test} & marginal homogeneity test (Stuart-Maxwell). \\ -\end{tabular} + \begin{tabular}{ll} + % CorrelationTests + \texttt{spearman\_test} & Spearman correlation test \\ + \texttt{fisyat\_test} & Fisher-Yates correlation test \\ + \texttt{quadrant\_test} & Quadrant test \\ + \texttt{koziol\_test} & Koziol-Nemec test \\ + % LocationTests + \texttt{oneway\_test} & Two- and $K$-sample Fisher-Pitman permutation + test \\ + \texttt{wilcox\_test} & Wilcoxon-Mann-Whitney test \\ + \texttt{kruskal\_test} & Kruskal-Wallis test \\ + \texttt{normal\_test} & Two- and $K$-sample van der Waerden test \\ + \texttt{median\_test} & Two- and $K$-sample Brown-Mood median test \\ + \texttt{savage\_test} & Two- and $K$-sample Savage test \\ + % ScaleTests + \texttt{taha\_test} & Two- and $K$-sample Taha test \\ + \texttt{klotz\_test} & Two- and $K$-sample Klotz test \\ + \texttt{mood\_test} & Two- and $K$-sample Mood test \\ + \texttt{ansari\_test} & Two- and $K$-sample Ansari-Bradley test \\ + \texttt{fligner\_test} & Two- and $K$-sample Fligner-Killeen test \\ + \texttt{conover\_test} & Two- and $K$-sample Conover-Iman test \\ + % SurvivalTests + \texttt{logrank\_test} & Two- and $K$-sample weighted logrank tests \\ + & (Logrank test, Gehan-Breslow test, Tarone-Ware + test, \dots) \\ + % SymmetryTests + \texttt{sign\_test} & Sign test \\ + \texttt{wilcoxsign\_test} & Wilcoxon signed-rank test \\ + \texttt{friedman\_test} & Friedman test and Page test \\ + \texttt{quade\_test} & Quade test \\ + % ContingencyTests + \texttt{chisq\_test} & Pearson $\chi^2$ test \\ + \texttt{cmh\_test} & Generalized Cochran-Mantel-Haenszel test \\ + \texttt{lbl\_test} & Linear-by-linear association test \\ + % MarginalHomogeneityTests + \texttt{mh\_test} & Marginal homogeneity tests \\ + & (McNemar test, Cochran $Q$ test, Stuart-Maxwell + test, \dots) \\ + % MaximallySelectedStatisticsTests + \texttt{maxstat\_test} & Generalized maximally selected statistics \\ + \end{tabular} \end{center} -Those convenience functions essentially perform a certain transformation of -the data, e.g., a rank transformation, and call \texttt{independence\_test} -for the computation of linear statistics, expectation and covariance and the -test statistic as well as -their null distribution. The exact null distribution can -be approximated either by the asymptotic distribution or via conditional -Monte Carlo for all test procedures, the exact null distribution is -available for special cases. Moreover, all test procedures allow for the -specification of blocks for stratification. +These convenience functions essentially perform a certain transformation of +the data, e.g., a rank transformation, and then call \texttt{independence\_test} +or \texttt{symmetry\_test} for the computation of the (multivariate) linear +statistic and its conditional expectation and covariance as well as the scalar +test statistic and its null distribution. The exact null distribution can +be approximated by the asymptotic distribution or via conditional +Monte Carlo resampling for all test procedures, whereas the exact null distribution is +available for special cases only. Moreover, all test procedures allow for the +specification of blocks pertaining to, e.g., stratification or repeated measurements. \section{Permutation Tests} @@ -146,11 +169,11 @@ \in \R^{pq}. \end{eqnarray} Here, $g: \mathcal{X} \rightarrow \R^{p}$ is a transformation of -the $\X$ measurements and the \emph{influence function} -$h: \mathcal{Y} \times \mathcal{Y}^n \rightarrow -\R^q$ depends on the responses $(\Y_1, \dots, \Y_n)$ in a permutation -symmetric way. We will give specific examples how to choose $g$ and $h$ -later on. +$\X$ known as the \emph{regression function} and $h: \mathcal{Y} \times +\mathcal{Y}^n \rightarrow \R^q$ is a transformation of $\Y$ known as the +\emph{influence function}, where the latter may depend on $(\Y_1, \dots, \Y_n)$ +in a permutation symmetric way. We will give specific examples on how to choose +$g$ and $h$ later on. The distribution of $\T$ depends on the joint distribution of $\Y$ and $\X$, which is unknown under almost all practical @@ -230,7 +253,7 @@ The conditional distribution and thus the $p$-value of the statistics $c(\mathbf{t}, \mu, \Sigma)$ can be computed in several different ways. For some special forms of the -linear statistic, the exact distribution of the test statistic is trackable. +linear statistic, the exact distribution of the test statistic is tractable. For two-sample problems, the shift-algorithm by \cite{axact-dist:1986} and \cite{exakte-ver:1987} and the split-up algorithm by \cite{vdWiel2001} are implemented as part of the package. @@ -254,9 +277,9 @@ The main workhorse \texttt{independence\_test} essentially allows for the specification of $\Y, \X$ and $b$ through a formula interface of the form -\verb/y ~ x | b/, weights can be defined by a formula with one variable on +\verb/y ~ x | b/, case weights can be defined by a formula with one variable on the right hand side only. Four additional arguments are available for the -specification of the transformation $g$ (\texttt{xtrans}), the influence +specification of the regression function $g$ (\texttt{xtrans}), the influence function $h$ (\texttt{ytrans}), the form of the test statistic $c$ (\texttt{teststat}) and the null distribution (\texttt{distribution}). @@ -277,18 +300,19 @@ 42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 38, 33, 26, 25, 28, 28, 26, 27, 27, 27, 31, 30, 27, 29, 30, 25, 25, 24, 27, 30), - site = factor(c(rep("I", 10), rep("II", 10), - rep("III", 10), rep("IV", 10)))) + site = gl(4, 10, labels = as.roman(1:4)) +) it <- independence_test(length ~ site, data = YOY, - ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo), - teststat = "quadratic") + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo), + teststat = "quadratic") it @ The linear statistic $\T$ is the sum of the ranks in each group and can be extracted via <>= -statistic(it, "linear") +statistic(it, type = "linear") @ Note that \texttt{statistic(..., type = "linear")} currently returns the linear statistic in matrix form, i.e. @@ -318,17 +342,17 @@ @ Life is much simpler with convenience functions very similar to those -available in package \pkg{stats} for a long time. The exact -null distribution of the Kruskal-Wallis test can be approximated by $9999$ -Monte Carlo replications via +available in package \pkg{stats} for a long time. Here, the exact +null distribution of the Kruskal-Wallis test is approximated by Monte Carlo +resampling using $10000$ replicates via <>= -kw <- kruskal_test(length ~ site, data = YOY, - distribution = approximate(B = 9999)) -kw +kt <- kruskal_test(length ~ site, data = YOY, + distribution = approximate(B = 10000)) +kt @ -with $p$-value (and $99\%$ confidence interval) of +with $p$-value (and $99~\%$ confidence interval) of <>= -pvalue(kw) +pvalue(kt) @ Of course it is possible to choose a $c_\text{max}$ type test statistic instead of a quadratic form. @@ -342,45 +366,55 @@ <>= data("jobsatisfaction", package = "coin") -it <- cmh_test(jobsatisfaction) -it +ct <- cmh_test(jobsatisfaction) +ct @ The standardized contingency table allowing for an inspection of the deviation from the null hypothesis of independence of income and jobsatisfaction (stratified by gender) is <>= -statistic(it, type = "standardized") +statistic(ct, type = "standardized") @ \paragraph{Ordered Alternatives.} Of course, both job satisfaction and income are ordered variables. When $\Y$ is measured at $J$ levels and $\X$ at $K$ levels, -$\Y$ and $\X$ are associated with score vectors $\xi \in +$\Y$ and $\X$ are associated with score vectors $\eta \in \R^J$ and $\gamma \in \R^K$, respectively. The linear statistic is now a linear combination of the linear statistic $\T$ of the form \begin{eqnarray*} \M \T & = & \vec \left( \sum_{i=1}^n w_i \gamma^\top g(\X_i) - \left(\xi^\top h(\Y_i, (\Y_1, \dots, \Y_n)\right)^\top \right) -\in \R \text{ with } \M = \xi \otimes \gamma. + \left(\eta^\top h(\Y_i, (\Y_1, \dots, \Y_n)\right)^\top \right) +\in \R \text{ with } \M = \eta \otimes \gamma. \end{eqnarray*} -By default, scores are $\xi = 1, \dots, J$ and $\gamma = 1, \dots, K$. +By default, scores are $\eta = 1, \dots, J$ and $\gamma = 1, \dots, K$. <>= lbl_test(jobsatisfaction) @ -The scores $\xi$ and $\gamma$ can be specified to the linear-by-linear -association test via a list those names correspond to the variable names +The scores $\eta$ and $\gamma$ can be specified to the linear-by-linear +association test via a list whose names correspond to the variable names <>= lbl_test(jobsatisfaction, scores = list(Job.Satisfaction = c(1, 3, 4, 5), Income = c(3, 10, 20, 35))) @ +Alternatively, scores can be specified through \texttt{of\_trafo} +<>= +lbl_test(jobsatisfaction, + ytrafo = function(data) + trafo(data, ordered_trafo = function(y) + of_trafo(y, scores = c(1, 3, 4, 5))), + xtrafo = function(data) + trafo(data, ordered_trafo = function(x) + of_trafo(x, scores = c(3, 10, 20, 35)))) +@ \paragraph{Incomplete Randomised Blocks.} \cite{RaynerBest2001}, Chapter 7, discuss the application of Durbin's test -to data from sensoric experiments, where incomplete block designs are +to data from sensory experiments, where incomplete block designs are common. As an example, data from taste-testing on ten dried eggs where mean scores for off-flavour from seven judges are given and one wants to assess whether there is any difference in the scores between the ten egg samples. @@ -388,55 +422,60 @@ `\texttt{|}'. <>= egg_data <- data.frame( - scores = c(9.7, 8.7, 5.4, 5.0, 9.6, 8.8, 5.6, 3.6, 9.0, + scores = c(9.7, 8.7, 5.4, 5.0, 9.6, 8.8, 5.6, 3.6, 9.0, 7.3, 3.8, 4.3, 9.3, 8.7, 6.8, 3.8, 10.0, 7.5, - 4.2, 2.8, 9.6, 5.1, 4.6, 3.6, 9.8, 7.4, 4.4, - 3.8, 9.4, 6.3, 5.1, 2.0, 9.4, 9.3, 8.2, 3.3, - 8.7, 9.0, 6.0, 3.3, 9.7, 6.7, 6.6, 2.8, 9.3, - 8.1, 3.7, 2.6, 9.8, 7.3, 5.4, 4.0, 9.0, 8.3, - 4.8,3.8,9.3,8.3,6.3,3.8), - sitting = factor(rep(c(1:15), rep(4,15))), - product = factor(c(1, 2, 4, 5, 2, 3, 6, 10, 2, 4, 6, 7, - 1, 3, 5, 7, 1, 4, 8, 10, 2, 7, 8, 9, - 2, 5, 8, 10, 5, 7, 9, 10, 1, 2, 3, 9, - 4, 5, 6, 9, 1, 6, 7, 10, 3, 4, 9, 10, - 1, 6, 8, 9, 3, 4, 7, 8, 3, 5, 6, 8))) -yt <- function(data) trafo(data, numeric_trafo = rank_trafo, - block = egg_data$sitting) + 4.2, 2.8, 9.6, 5.1, 4.6, 3.6, 9.8, 7.4, 4.4, + 3.8, 9.4, 6.3, 5.1, 2.0, 9.4, 9.3, 8.2, 3.3, + 8.7, 9.0, 6.0, 3.3, 9.7, 6.7, 6.6, 2.8, 9.3, + 8.1, 3.7, 2.6, 9.8, 7.3, 5.4, 4.0, 9.0, 8.3, + 4.8, 3.8, 9.3, 8.3, 6.3, 3.8), + sitting = factor(rep(c(1:15), rep(4, 15))), + product = factor(c(1, 2, 4, 5, 2, 3, 6, 10, 2, 4, 6, 7, + 1, 3, 5, 7, 1, 4, 8, 10, 2, 7, 8, 9, + 2, 5, 8, 10, 5, 7, 9, 10, 1, 2, 3, 9, + 4, 5, 6, 9, 1, 6, 7, 10, 3, 4, 9, 10, + 1, 6, 8, 9, 3, 4, 7, 8, 3, 5, 6, 8)) +) + independence_test(scores ~ product | sitting, - data = egg_data, teststat = "quadratic", - ytrafo = yt) + data = egg_data, teststat = "quadratic", + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting)) @ and the Monte Carlo $p$-value can be computed via <>= pvalue(independence_test(scores ~ product | sitting, - data = egg_data, teststat = "quadratic", ytrafo = yt, - distribution = approximate(B = 19999))) + data = egg_data, teststat = "quadratic", + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting), + distribution = approximate(B = 19999))) @ If we assume that the products are ordered, the Page test is appropriate and can be computed as follows -<>= -independence_test(scores ~ product | sitting, data = egg_data, - scores = list(product = 1:10), - ytrafo = yt) +<>= +independence_test(scores ~ product | sitting, + data = egg_data, + ytrafo = function(data) + trafo(data, numeric_trafo = rank_trafo, + block = egg_data$sitting), + scores = list(product = 1:10)) @ - \paragraph{Multiple Tests.} One may be interested in testing multiple hypotheses simultaneously, either by using a linear combination of the linear statistic $\K\T$, or by -specifying multivariate variables $\Y$ and / or $\X$. For example, all pair +specifying multivariate variables $\Y$ and/or $\X$. For example, all pair comparisons may be implemented via <>= -if (require("multcomp")) { - xt <- function(data) trafo(data, factor_trafo = function(x) - tcrossprod(model.matrix(~x - 1), contrMat(table(x), "Tukey"))) - it <- independence_test(length ~ site, data = YOY, xtrafo = xt, - teststat = "maximum", distribution = approximate(B = 9999)) - print(pvalue(it)) - print(pvalue(it, method = "single-step")) -} +it <- independence_test(length ~ site, data = YOY, + xtrafo = mcp_trafo(site = "Tukey"), + teststat = "maximum", + distribution = "approximate") +pvalue(it) +pvalue(it, method = "single-step") @ When either $g$ or $h$ are multivariate, single-step adjusted $p$-values based on maximum-type statistics are computed as described in \cite{WestfallYoung1993}, @@ -447,34 +486,6 @@ treatment effect of \texttt{site} is the basis of all adjustments instead of the corresponding partial null-hypothesis. -Another important application are simultaneous tests for many response -variables. This problem frequently occurs in microarray expression studies -and we shall have a look at an artificial example: 100 variables (from a -normal distribution) are to be tested in a one-way classification with $n = -40$ observations. Only the first variable shows a difference and we are -interested in both a global test and the adjusted $p$-values. Here, the -example is formulated within the \pkg{Biobase} \citep{PKG:Biobase} -framework (example currently not run because of dependencies problems): -<>= -if (require("Biobase")) { - - p <- 100 - pd <- new("AnnotatedDataFrame", - data = data.frame(group = gl(2, 20)), - varMetadata = data.frame(labelDescription = "1/2")) - exprs <- matrix(rnorm(p * 40), nrow = p) - exprs[1, 1:20] <- exprs[1, 1:20] + 1.5 - ex <- new("ExpressionSet", exprs = exprs, phenoData = pd) - - it <- independence_test(group ~ ., data = ex, - distribution = approximate(B = 1000)) - - print(pvalue(it)) - print(which(pvalue(it, method = "step-down") < 0.05)) - -} -@ - \section{Quality Assurance} The test procedures implemented in package \pkg{coin} are continuously checked diff -Nru r-cran-coin-1.1-0/vignettes/coin.Rout.save r-cran-coin-1.1-2/vignettes/coin.Rout.save --- r-cran-coin-1.1-0/vignettes/coin.Rout.save 2015-07-01 12:45:51.000000000 +0000 +++ r-cran-coin-1.1-2/vignettes/coin.Rout.save 2015-10-26 11:10:59.000000000 +0000 @@ -5,48 +5,6 @@ Loading required package: coin Loading required package: survival -> require("Biobase") -Loading required package: Biobase -Loading required package: BiocGenerics -Loading required package: parallel - -Attaching package: 'BiocGenerics' - -The following objects are masked from 'package:parallel': - - clusterApply, clusterApplyLB, clusterCall, - clusterEvalQ, clusterExport, clusterMap, - parApply, parCapply, parLapply, parLapplyLB, - parRapply, parSapply, parSapplyLB - -The following object is masked from 'package:stats': - - xtabs - -The following objects are masked from 'package:base': - - Filter, Find, Map, Position, Reduce, - anyDuplicated, append, as.data.frame, as.vector, - cbind, colnames, do.call, duplicated, eval, - evalq, get, intersect, is.unsorted, lapply, - mapply, match, mget, order, paste, pmax, - pmax.int, pmin, pmin.int, rank, rbind, rep.int, - rownames, sapply, setdiff, sort, table, tapply, - union, unique, unlist, unsplit - -Welcome to Bioconductor - - Vignettes contain introductory material; view - with 'browseVignettes()'. To cite Bioconductor, - see 'citation("Biobase")', and for packages - 'citation("pkgname")'. - - -> require("multcomp") -Loading required package: multcomp -Loading required package: mvtnorm -Loading required package: TH.data - > set.seed(290875) > library("coin") @@ -67,7 +25,7 @@ chi-squared = 22.852, df = 3, p-value = 4.335e-05 -> statistic(it, "linear") +> statistic(it, type = "linear") I 278 II 307 @@ -98,9 +56,9 @@ > pvalue(it) [1] 4.334659e-05 -> kw <- kruskal_test(length ~ site, data = YOY, distribution = approximate(B = 9999)) +> kt <- kruskal_test(length ~ site, data = YOY, distribution = approximate(B = 10000)) -> kw +> kt Approximative Kruskal-Wallis Test @@ -108,17 +66,17 @@ chi-squared = 22.852, p-value < 2.2e-16 -> pvalue(kw) +> pvalue(kt) [1] 0 99 percent confidence interval: - 0.0000000000 0.0005297444 + 0.0000000000 0.0005296914 > data("jobsatisfaction", package = "coin") -> it <- cmh_test(jobsatisfaction) +> ct <- cmh_test(jobsatisfaction) -> it +> ct Asymptotic Generalized Cochran-Mantel-Haenszel Test @@ -128,7 +86,7 @@ chi-squared = 10.2, df = 9, p-value = 0.3345 -> statistic(it, type = "standardized") +> statistic(ct, type = "standardized") Very Dissatisfied A Little Satisfied <5000 1.3112789 0.69201053 5000-15000 0.6481783 0.83462550 @@ -163,15 +121,26 @@ alternative hypothesis: two.sided +> lbl_test(jobsatisfaction, ytrafo = function(data) trafo(data, ++ ordered_trafo = function(y) of_trafo(y, scores = c(1, 3, ++ 4, 5))), xt .... [TRUNCATED] + + Asymptotic Linear-by-Linear Association Test + +data: Job.Satisfaction (ordered) by + Income (<5000 < 5000-15000 < 15000-25000 < >25000) + stratified by Gender +Z = 2.4812, p-value = 0.01309 +alternative hypothesis: two.sided + + > egg_data <- data.frame(scores = c(9.7, 8.7, 5.4, 5, + 9.6, 8.8, 5.6, 3.6, 9, 7.3, 3.8, 4.3, 9.3, 8.7, 6.8, 3.8, + 10, 7.5, 4.2, 2.8, 9.6, .... [TRUNCATED] -> yt <- function(data) trafo(data, numeric_trafo = rank_trafo, -+ block = egg_data$sitting) - > independence_test(scores ~ product | sitting, data = egg_data, -+ teststat = "quadratic", ytrafo = yt) ++ teststat = "quadratic", ytrafo = function(data) trafo(data, ++ numeric .... [TRUNCATED] Asymptotic General Independence Test @@ -182,14 +151,16 @@ > pvalue(independence_test(scores ~ product | sitting, -+ data = egg_data, teststat = "quadratic", ytrafo = yt, distribution = approximate(B = 199 .... [TRUNCATED] ++ data = egg_data, teststat = "quadratic", ytrafo = function(data) trafo(data, ++ .... [TRUNCATED] [1] 0 99 percent confidence interval: 0.000000000 0.000264894 > independence_test(scores ~ product | sitting, data = egg_data, -+ scores = list(product = 1:10), ytrafo = yt) ++ ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo, ++ blo .... [TRUNCATED] Asymptotic General Independence Test @@ -200,22 +171,28 @@ alternative hypothesis: two.sided -> if (require("multcomp")) { -+ xt <- function(data) trafo(data, factor_trafo = function(x) tcrossprod(model.matrix(~x - -+ 1), contrMat(ta .... [TRUNCATED] -[1] 0.00010001 +> it <- independence_test(length ~ site, data = YOY, ++ xtrafo = mcp_trafo(site = "Tukey"), teststat = "maximum", ++ distribution = "approxima ..." ... [TRUNCATED] + +> pvalue(it) +[1] 1e-04 99 percent confidence interval: - 5.013042e-07 7.428484e-04 + 5.012541e-07 7.427741e-04 + - -II - I 0.66186619 -III - I 0.03990399 -IV - I 0.02280228 -III - II 0.00010001 -IV - II 0.00010001 -IV - III 0.99889989 +> pvalue(it, method = "single-step") +Warning in .local(object, ...) : + p-values may be incorrect due to violation of the subset pivotality condition + +II - I 0.6618 +III - I 0.0399 +IV - I 0.0228 +III - II 0.0001 +IV - II 0.0001 +IV - III 0.9989 *** Run successfully completed *** > proc.time() user system elapsed - 1.37 0.20 1.71 + 0.95 0.04 1.56