
> options(width = 60)

> require("coin")
Loading required package: coin
Loading required package: survival

> set.seed(290875)

> library("coin")

> YOY <- data.frame(length = c(46, 28, 46, 37, 32, 41, 
+     42, 45, 38, 44, 42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 38, 
+     33, 26, 25, 28, 28, 2 .... [TRUNCATED] 

> it <- independence_test(length ~ site, data = YOY, 
+     ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo), 
+     teststat = "quadra ..." ... [TRUNCATED] 

> it

	Asymptotic General Independence Test

data:  length by site (I, II, III, IV)
chi-squared = 22.852, df = 3, p-value = 4.335e-05


> statistic(it, type = "linear")
       
I   278
II  307
III 119
IV  116

> expectation(it)
  I  II III  IV 
205 205 205 205 

> covariance(it)
            I        II       III        IV
I   1019.0385 -339.6795 -339.6795 -339.6795
II  -339.6795 1019.0385 -339.6795 -339.6795
III -339.6795 -339.6795 1019.0385 -339.6795
IV  -339.6795 -339.6795 -339.6795 1019.0385

> statistic(it, type = "standardized")
             
I    2.286797
II   3.195250
III -2.694035
IV  -2.788013

> statistic(it)
[1] 22.85242

> pvalue(it)
[1] 4.334659e-05

> kt <- kruskal_test(length ~ site, data = YOY, distribution = approximate(B = 10000))

> kt

	Approximative Kruskal-Wallis Test

data:  length by site (I, II, III, IV)
chi-squared = 22.852, p-value < 2.2e-16


> pvalue(kt)
[1] 0
99 percent confidence interval:
 0.0000000000 0.0005296914 


> data("jobsatisfaction", package = "coin")

> ct <- cmh_test(jobsatisfaction)

> ct

	Asymptotic Generalized Cochran-Mantel-Haenszel Test

data:  Job.Satisfaction by
	 Income (<5000, 5000-15000, 15000-25000, >25000) 
	 stratified by Gender
chi-squared = 10.2, df = 9, p-value = 0.3345


> statistic(ct, type = "standardized")
            Very Dissatisfied A Little Satisfied
<5000               1.3112789         0.69201053
5000-15000          0.6481783         0.83462550
15000-25000        -1.0958361        -1.50130926
>25000             -1.0377629        -0.08983052
            Moderately Satisfied Very Satisfied
<5000                 -0.2478705     -0.9293458
5000-15000             0.5175755     -1.6257547
15000-25000            0.2361231      1.4614123
>25000                -0.5946119      1.2031648

> lbl_test(jobsatisfaction)

	Asymptotic Linear-by-Linear Association Test

data:  Job.Satisfaction (ordered) by
	 Income (<5000 < 5000-15000 < 15000-25000 < >25000) 
	 stratified by Gender
Z = 2.5736, p-value = 0.01006
alternative hypothesis: two.sided


> lbl_test(jobsatisfaction, scores = list(Job.Satisfaction = c(1, 
+     3, 4, 5), Income = c(3, 10, 20, 35)))

	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


> 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] 

> independence_test(scores ~ product | sitting, data = egg_data, 
+     teststat = "quadratic", ytrafo = function(data) trafo(data, 
+         numeric .... [TRUNCATED] 

	Asymptotic General Independence Test

data:  scores by
	 product (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 
	 stratified by sitting
chi-squared = 39.12, df = 9, p-value = 1.096e-05


> pvalue(independence_test(scores ~ product | sitting, 
+     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, 
+     ytrafo = function(data) trafo(data, numeric_trafo = rank_trafo, 
+         blo .... [TRUNCATED] 

	Asymptotic General Independence Test

data:  scores by
	 product (1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10) 
	 stratified by sitting
Z = -6.2166, p-value = 5.081e-10
alternative hypothesis: two.sided


> 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.012541e-07 7.427741e-04 


> 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 
   0.95    0.04    1.56 
