File: Tukey.R

package info (click to toggle)
r-cran-mutoss 0.1-13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,560 kB
  • sloc: sh: 13; makefile: 2
file content (63 lines) | stat: -rw-r--r-- 2,087 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Tukey HSD Test in parametric factorial designs
# 
# Author: FrankKonietschke
###############################################################################












tukey.wrapper <- function(model, alpha,factorC) {
	
	model <- aov(model)
	tukeyObj <- TukeyHSD(model,conf.level=1-alpha, factorC)
	

	estimates <- c(tukeyObj)[[1]][,1]
	confintL <- c(tukeyObj)[[1]][,2]
	confintU <- c(tukeyObj)[[1]][,3]
	confi <- cbind(estimates, confintL, confintU)
	pvalues <- c(tukeyObj)[[1]][,4]
	
	
	
	rejected1 <- (pvalues < alpha)
	#confi <- cbind(confint)
	print(cbind(confi,pvalues))
	return(list(adjPValues=pvalues,rejected=rejected1,confIntervals= confi,
					errorControl = new(Class='ErrorControl',type="FWER",alpha=alpha)))
}


#tukey.wrapper(aov(breaks~wool*tension,data=warpbreaks),alpha=0.05,"tension")

mutoss.tukey<- function() { return(new(Class="MutossMethod",
					label="Tukey HSD Test",
					errorControl="FWER",
					callFunction="tukey.wrapper",
					output=c("adjPValues", "rejected","confIntervals","errorControl"),
					info="<h2>Tukey HSD test and simultaneous confidence intervals in parametric factorial designs</h2>
							<p>'With this function, it is possible to compute all pairs comparisons for expectations and 
                              simultaneous confidence intervals in factorial linear models. Hereby, the all-pairs comparisons
                              can be performed for user given effects. The overall variance is estimated by the linear model
                              as well as the degree of freedom used by the studentized range distribution. <p> 
							<p></p>
							<h3>Reference:</h3>
							<ul>
							<li>Tukey, J.W. \"<i>The problem of multiple comparisons. Unpublished manuscript
reprinted in: The Collected Works of John W. Tukey (1953).</i>\" Volume 8 (1994),Braun, H.I. (ed.), Chapman and Hall, New York.</li>
							</ul>",
					parameters=list(model=list(type="ANY"),
							
							alpha=list(type="numeric"),
							factorC=list(type="character", label="Factor for Comparison", fromR="FactorVar")
					
					)
			)) }