



























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!




























































































Version 1.3-
Date 2019-08-
Title Conditional Inference Procedures in a Permutation Test Framework
Description Conditional inference procedures for the general independence problem including two-sample, K-sample (non-parametric ANOVA), correlation, censored, ordered and multivariate problems.
Depends R (>= 3.4.0), survival
Imports methods, parallel, stats, stats4, utils, libcoin (>= 1.0-0), matrixStats (>= 0.54.0), modeltools (>= 0.2-9), mvtnorm (>= 1.0-5), multcomp
Suggests xtable, e1071, vcd, TH.data (>= 1.0-7)
LinkingTo libcoin (>= 1.0-0)
LazyData yes
NeedsCompilation yes
ByteCompile yes
License GPL-
URL http://coin.r-forge.r-project.org
Author Torsten Hothorn [aut, cre] (), Henric Winell [aut] (), Kurt Hornik [aut] (), Mark A. van de Wiel [aut] (), Achim Zeileis [aut] ()
Maintainer Torsten Hothorn
Repository CRAN
Date/Publication 2019-08-28 11:50:06 UTC
coin-package........................................ 3 alpha............................................. 4
4 alpha
Examples
tmpdir <- tempdir() tgz <- download.packages("coin", destdir = tmpdir, type = "source")[2]
untar(tgz, exdir = tmpdir)
wd <- setwd(file.path(tmpdir, "coin")) system("doxygen inst/doxygen.cfg") setwd(wd)
browseURL(file.path(tmpdir, "coin", "inst", "documentation", "html", "index.html"))
alpha Genetic Components of Alcoholism
Description
Levels of expressed alpha synuclein mRNA in three groups of allele lengths of NACP-REP1.
Usage
alpha
Format
A data frame with 97 observations on 2 variables.
alength allele length, a factor with levels "short", "intermediate" and "long". elevel expression levels of alpha synuclein mRNA.
Details
Various studies have linked alcohol dependence phenotypes to chromosome 4. One candidate gene is NACP (non-amyloid component of plaques), coding for alpha synuclein. Bönsch et al. (2005) found longer alleles of NACP-REP1 in alcohol-dependent patients compared with healthy controls and reported that the allele lengths show some association with levels of expressed alpha synuclein mRNA.
Source
Bönsch, D., Lederer, T., Reulbach, U., Hothorn, T., Kornhuber, J. and Bleich, S. (2005). Joint analysis of the NACP-REP1 marker within the alpha synuclein gene concludes association with alcohol dependence. Human Molecular Genetics 14 (7), 967–971. doi: 10.1093/hmg/ddi
alzheimer 5
References
Hothorn, T., Hornik, K., van de Wiel, M. A. and Zeileis, A. (2006). A Lego system for conditional inference. The American Statistician 60 (3), 257–263. doi: 10.1198/000313006X Winell, H. and Lindbäck, J. (2018). A general score-independent test for order-restricted inference. Statistics in Medicine 37 (21), 3078–3090. doi: 10.1002/sim.
Examples
boxplot(elevel ~ alength, data = alpha)
kruskal_test(elevel ~ alength, data = alpha)
kruskal_test(elevel ~ alength, data = alpha, scores = list(alength = c(2, 7, 11)))
(it <- independence_test(elevel ~ alength, data = alpha, ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo), xtrafo = function(data) trafo(data, factor_trafo = function(x) zheng_trafo(as.ordered(x)))))
ss <- statistic(it, type = "standardized") idx <- which(abs(ss) == max(abs(ss)), arr.ind = TRUE) ss[idx[1], idx[2], drop = FALSE]
alzheimer Smoking and Alzheimer’s Disease
Description
A case-control study of smoking and Alzheimer’s disease.
Usage
alzheimer
Format
A data frame with 538 observations on 3 variables.
smoking a factor with levels "None", "<10", "10-20" and ">20" (cigarettes per day). disease a factor with levels "Alzheimer", "Other dementias" and "Other diagnoses". gender a factor with levels "Female" and "Male".
ContingencyTests 7
Details
The aim of this toxicological study is the proof of safety for the new compound. The data were originally given in Hothorn (1992) and later reproduced by Hauschke, Kieser and Hothorn (1999).
Source
Hauschke, D., Kieser, M. and Hothorn, L. A. (1999). Proof of safety in toxicology based on the ratio of two means for normally distributed data. Biometrical Journal 41 (3), 295–304. doi: 10.1002/ (SICI)15214036(199906)41:3<295::AIDBIMJ295>3.0.CO; Hothorn, L. A. (1992). Biometrische analyse toxikologischer untersuchungen. In J. Adam (Ed.), Statistisches Know-How in der Medizinischen Forschung, pp. 475–590. Berlin: Ullstein Mosby.
References
Pflüger, R. and Hothorn, T. (2002). Assessing equivalence tests with respect to their expected p- value. Biometrical Journal 44 (8), 1015–1027. doi: 10.1002/bimj.
Examples
wt <- wilcox_test(I(log(asat)) ~ group, data = asat, distribution = "exact", alternative = "less", conf.int = TRUE)
exp(confint(wt)$conf.int)
ContingencyTests Tests of Independence in Two- or Three-Way Contingency Tables
Description
Testing the independence of two nominal or ordered factors.
Usage
chisq_test(formula, data, subset = NULL, weights = NULL, ...)
chisq_test(object, ...)
chisq_test(object, ...)
8 ContingencyTests
cmh_test(formula, data, subset = NULL, weights = NULL, ...)
cmh_test(object, ...)
cmh_test(object, ...)
lbl_test(formula, data, subset = NULL, weights = NULL, ...)
lbl_test(object, ...)
lbl_test(object, ...)
Arguments
formula a formula of the form y ~ x | block where y and x are factors and block is an optional factor for stratification. data an optional data frame containing the variables in the model formula. subset an optional vector specifying a subset of observations to be used. Defaults to NULL. weights an optional formula of the form ~ w defining integer valued case weights for each observation. Defaults to NULL, implying equal weight for all observations. object an object inheriting from classes "table" or "IndependenceProblem". ... further arguments to be passed to independence_test.
Details
chisq_test, cmh_test and lbl_test provide the Pearson chi-squared test, the generalized Cochran- Mantel-Haenszel test and the linear-by-linear association test. A general description of these meth- ods is given by Agresti (2002). The null hypothesis of independence, or conditional independence given block, between y and x is tested. If y and/or x are ordered factors, the default scores, 1:nlevels(y) and 1:nlevels(x) respectively, can be altered using the scores argument (see independence_test); this argument can also be used to coerce nominal factors to class "ordered". (lbl_test coerces to class "ordered" un- der any circumstances.) If both y and x are ordered factors, a linear-by-linear association test is computed and the direction of the alternative hypothesis can be specified using the alternative argument. For the Pearson chi-squared test, this extension was given by Yates (1948) who also dis- cussed the situation when either the response or the covariate is an ordered factor; see also Cochran (1954) and Armitage (1955) for the particular case when y is a binary factor and x is ordered. The Mantel-Haenszel statistic (Mantel and Haenszel, 1959) was similarly extended by Mantel (1963) and Landis, Heyman and Koch (1978). The conditional null distribution of the test statistic is used to obtain p-values and an asymptotic approximation of the exact distribution is used by default (distribution = "asymptotic"). Alter- natively, the distribution can be approximated via Monte Carlo resampling or computed exactly for univariate two-sample problems by setting distribution to "approximate" or "exact" respec- tively. See asymptotic, approximate and exact for details.
10 ContingencyTests
midpvalue(ct) # mid-p-value pvalue_interval(ct) # p-value interval size(ct, alpha = 0.05) # test size at alpha = 0.05 using the p-value
ct <- chisq_test(davis, distribution = "exact") pvalue(ct) # standard p-value midpvalue(ct) # mid-p-value pvalue_interval(ct) # p-value interval size(ct, alpha = 0.05) # test size at alpha = 0.05 using the p-value fisher.test(davis)
cancer <- matrix( c(21, 2, 15, 3), nrow = 2, byrow = TRUE, dimnames = list( "Treatment" = c("Surgery", "Radiation"), "Cancer" = c("Controlled", "Not Controlled") ) ) cancer <- as.table(cancer)
(ct <- chisq_test(cancer, distribution = "exact")) midpvalue(ct) # mid-p-value pvalue_interval(ct) # p-value interval size(ct, alpha = 0.05) # test size at alpha = 0.05 using the p-value fisher.test(cancer)
yates <- matrix( c(141, 67, 114, 79, 39, 131, 66, 143, 72, 35, 36, 14, 38, 28, 16), byrow = TRUE, ncol = 5, dimnames = list( "Rating" = c("A", "B", "C"), "Condition" = c("A", "B", "C", "D", "E") ) ) yates <- as.table(yates)
ContingencyTests 11
chisq_test(yates)
(ct <- chisq_test(yates, alternative = "less", scores = list("Rating" = c(-1, 0, 1), "Condition" = c(2, 1, 0, -1, -2)))) statistic(ct)^2 # chi^2 = 2.
chisq_test(yates, scores = list("Rating" = c(-1, 0, 1))) # Q = 3.
cochran <- matrix( c(11, 7, 27, 15, 42, 16, 53, 13, 11, 1), byrow = TRUE, ncol = 2, dimnames = list( "Change" = c("Marked", "Moderate", "Slight", "Stationary", "Worse"), "Infiltration" = c("0-7", "8-15") ) ) cochran <- as.table(cochran)
chisq_test(cochran) # X^2 = 6.
(ct <- chisq_test(cochran, scores = list("Change" = c(3, 2, 1, 0, -1)))) statistic(ct)^2 # X^2 = 6.
armitage <- matrix( c( 6, 4, 10, 12, 11, 8, 8, 5), byrow = TRUE, ncol = 4, dimnames = list( "Treatment" = c("A", "B"), "Crater" = c("Larger", "< 2/3 healed", ">= 2/3 healed", "Healed")
CorrelationTests 13
fisyat_test(object, distribution = c("asymptotic", "approximate", "none"), ties.method = c("mid-ranks", "average-scores"), ...)
quadrant_test(formula, data, subset = NULL, weights = NULL, ...)
quadrant_test(object, distribution = c("asymptotic", "approximate", "none"), mid.score = c("0", "0.5", "1"), ...)
koziol_test(formula, data, subset = NULL, weights = NULL, ...)
koziol_test(object, distribution = c("asymptotic", "approximate", "none"), ties.method = c("mid-ranks", "average-scores"), ...)
Arguments
formula a formula of the form y ~ x | block where y and x are numeric variables and block is an optional factor for stratification. data an optional data frame containing the variables in the model formula. subset an optional vector specifying a subset of observations to be used. Defaults to NULL. weights an optional formula of the form ~ w defining integer valued case weights for each observation. Defaults to NULL, implying equal weight for all observations. object an object inheriting from class "IndependenceProblem". distribution a character, the conditional null distribution of the test statistic can be approx- imated by its asymptotic distribution ("asymptotic", default) or via Monte Carlo resampling ("approximate"). Alternatively, the functions asymptotic or approximate can be used. Computation of the null distribution can be sup- pressed by specifying "none". ties.method a character, the method used to handle ties: the score generating function ei- ther uses mid-ranks ("mid-ranks", default) or averages the scores of randomly broken ties ("average-scores"). mid.score a character, the score assigned to observations exactly equal to the median: ei- ther 0 ("0", default), 0.5 ("0.5") or 1 ("1"); see median_test. ... further arguments to be passed to independence_test.
Details
spearman_test, fisyat_test, quadrant_test and koziol_test provide the Spearman correla- tion test, the Fisher-Yates correlation test using van der Waerden scores, the quadrant test and the Koziol-Nemec test. A general description of these methods is given by Hájek, Šidák and Sen (1999, Sec. 4.6). The Koziol-Nemec test was suggested by Koziol and Nemec (1979). For the adjustment of scores for tied values see Hájek, Šidák and Sen (1999, pp. 133–135). The null hypothesis of independence, or conditional independence given block, between y and x is tested.
The conditional null distribution of the test statistic is used to obtain p-values and an asymptotic approximation of the exact distribution is used by default (distribution = "asymptotic"). Alter- natively, the distribution can be approximated via Monte Carlo resampling by setting distribution to "approximate". See asymptotic and approximate for details.
Value
An object inheriting from class "IndependenceTest".
References
Hájek, J., Šidák, Z. and Sen, P. K. (1999). Theory of Rank Tests, Second Edition. San Diego: Academic Press. Koziol, J. A. and Nemec, A. F. (1979). On a Cramér-von Mises type statistic for testing bivariate independence. The Canadian Journal of Statistics 7 (1), 43–52. doi: 10.2307/
Examples
spearman_test(CONT ~ INTG, data = USJudgeRatings)
fisyat_test(CONT ~ INTG, data = USJudgeRatings)
quadrant_test(CONT ~ INTG, data = USJudgeRatings)
koziol_test(CONT ~ INTG, data = USJudgeRatings)
CWD Coarse Woody Debris
Description
Carbon flux on six pieces of wood.
Usage
CWD
Format
A data frame with 13 observations on 8 variables.
sample2 carbon flux measurement for 2nd piece of wood. sample3 carbon flux measurement for 3rd piece of wood. sample4 carbon flux measurement for 4th piece of wood.
16 expectation-methods
mt <- maxstat_test(sample2 + sample3 + sample4 + sample6 + sample7 + sample8 ~ trend, data = CWD, distribution = approximate(nresample = 100000))
statistic(mt)
(c <- qperm(mt, 0.95))
sts <- statistic(mt, type = "standardized") idx <- which(sts > c, arr.ind = TRUE) sts[unique(idx[, 1]), unique(idx[, 2]), drop = FALSE]
expectation-methods Extraction of the Expectation, Variance and Covariance of the Linear Statistic
Description
Methods for extraction of the expectation, variance and covariance of the linear statistic.
Usage
expectation(object, ...)
expectation(object, ...)
variance(object, ...)
variance(object, ...)
variance(object, ...)
variance(object, ...)
covariance(object, ...)
covariance(object, ...)
covariance(object, ...)
glioma 17
Arguments
object an object from which the expectation, variance or covariance of the linear statis- tic can be extracted. ... further arguments (currently ignored).
Details
The methods expectation, variance and covariance extract the expectation, variance and co- variance, respectively, of the linear statistic.
Value
The expectation, variance or covariance of the linear statistic extracted from object. A numeric vector or matrix.
Examples
dta <- data.frame( y = gl(3, 2), x = sample(gl(3, 2)) )
ct <- cmh_test(y ~ x, data = dta)
(l <- statistic(ct, type = "linear"))
(El <- expectation(ct))
(Vl <- covariance(ct))
(l - El) / sqrt(variance(ct))
statistic(ct, type = "standardized")
glioma Malignant Glioma Pilot Study
Description
A non-randomized pilot study on malignant glioma patients with pretargeted adjuvant radioim- munotherapy using yttrium-90-biotin.
gbm <- subset(glioma, histology == "GBM")
plot(survfit(Surv(time, event) ~ group, data = gbm), main = "Grade IV Glioma", lty = 2:1, ylab = "Probability", xlab = "Survival Time in Month", xlim = c(-2, 72)) legend("topright", lty = 2:1, c("Control", "Treated"), bty = "n") par(op) # reset
logrank_test(Surv(time, event) ~ group, data = gbm, distribution = "exact")
logrank_test(Surv(time, event) ~ group | histology, data = glioma, distribution = approximate(nresample = 10000))
GTSG Gastrointestinal Tumor Study Group
Description
A randomized clinical trial in gastric cancer.
Usage
GTSG
Format
A data frame with 90 observations on 3 variables.
time survival time (days). event status indicator for time: 0 for right-censored observations and 1 otherwise. group a factor with levels "Chemotherapy+Radiation" and "Chemotherapy".
Details
A clinical trial comparing chemotherapy alone versus a combination of chemotherapy and radiation therapy in the treatment of locally advanced, nonresectable gastric carcinoma.
Note
There is substantial separation between the estimated survival distributions at 8 to 10 months, but by month 26 the distributions intersect.
Source
Stablein, D. M., Carter, W. H., Jr. and Novak, J. W. (1981). Analysis of survival data with nonproportional hazard functions. Controlled Clinical Trials 2 (2), 149–159. doi: 10.1016/0197- 2456(81)
References
Moreau, T., Maccario, J., Lellouch, J. and Huber, C. (1992). Weighted log rank statistics for com- paring two distributions. Biometrika 79 (1), 195–198. doi: 10.1093/biomet/79.1.
Shen, W. and Le, C. T. (2000). Linear rank tests for censored survival data. Communications in Statistics – Simulation and Computation 29 (1), 21–36. doi: 10.1080/
Tubert-Bitter, P., Kramar, A., Chalé, J. J. and Moureau, T. (1994). Linear rank tests for comparing survival in two groups with crossing hazards. Computational Statistics & Data Analysis 18 (5), 547–559. doi: 10.1016/01679473(94)
Examples
plot(survfit(Surv(time / (365.25 / 12), event) ~ group, data = GTSG), lty = 1:2, ylab = "% Survival", xlab = "Survival Time in Months") legend("topright", lty = 1:2, c("Chemotherapy+Radiation", "Chemotherapy"), bty = "n")
logrank_test(Surv(time, event) ~ group, data = GTSG)
logrank_test(Surv(time, event) ~ group, data = GTSG, type = "Prentice")
moreau_weight <- function(time, n.risk, n.event) 1 + log(-log(cumprod(n.risk / (n.risk + n.event))))
independence_test(Surv(time, event) ~ group, data = GTSG, ytrafo = function(data) trafo(data, surv_trafo = function(y) logrank_trafo(y, weight = moreau_weight)))
shen_trafo <- function(x) ansari_trafo(logrank_trafo(x, type = "Prentice"))
independence_test(Surv(time, event) ~ group, data = GTSG, ytrafo = function(data) trafo(data, surv_trafo = shen_trafo))