combine(npc) 
R Documentation 
Provides the Nonparametric
combination of dependent variables. It allows to combine partial tests with
respect to variables or groups (contrasts). It also allows to obtain a global
test by repeatedly applying this function together with the function t2p
.
combine(P,fun=c("Direct","Fisher","Liptak","Max_T","Tippett"),which=c(2,3),W=NULL)

an array
containing the permutation distribution of the partial tests. It can be a two
or a three dimension array. The first dimension is always equal to 

the combining function to be applied in the nonparametric combination of partial tests. See Details for the description of the combining functions. 

the
dimension with respect to which the nonparametric combination has to be done.
Set 

An
(optional) vector of weights, with the length equal to 
This function is very flexible and
represents the core point of the Nonparametric combination methodology. It
allows to combine arrays with either the permutation distribution of the
partial tests or their related pvalues. If fun = "Direct"
or "Max_T"
, then the input matrix P
must be the matrix with the
permutation values of the test statistic. Otherwise, if fun =
"Fisher"
,
"Liptak"
or "Tippett"
the input matrix must be made of
the pvalues of the partial tests. The argument "which"
specifies the dimension with
respect to the combination has to be done.
The "Direct"
function is the (weighted) sum of
the partial statistics f(w,x) = t(w)%*%x
, where w
is the weigth vector and x
is the considered vector of the
partial statistics. The "Max_T"
function corresponds to the maximum of the
(weighted) partial statistics, f(w,x) = max(t(w)%*%x)
, where the maximum is referred to
the dimension specified by the which
argument.
The "Fisher"
function is f(w,p) =
2*t(w)%*%log(p)
,
where w
is the
weigth vector and p
is the considered vector of the pvalues of the partial statistics. The
"Liptack"
function is the (weighted) sum of
the inverse standard normal C.d.f. f(w,p) = t(w)*%qnorm(1p)
. The "Tippett"
function is f(w,p) =
min(t(w)%*%p)
.
A matrix T1
with dimensions [B+1, p]
if which = 3
or with dimensions [B+1, C]
if which = 2
containing the values of the
combined partial tests.
## Example on producing plastic film from Krzanowski (1998, p. 381)
## Two sample problem with three (dependent) variables. Partial tests are required with onesided alternatives.
n1<9
n2<11
n<n1+n2
tear < c(6.5, 6.2, 5.8, 6.5, 6.5, 6.9, 7.2, 6.9, 6.1, 6.3,
6.7, 6.6, 7.2, 7.1, 6.8, 7.1, 7.0, 7.2, 7.5, 7.6)
gloss < c(9.5, 9.9, 9.6, 9.6, 9.2, 9.1, 10.0, 9.9, 9.5, 9.4,
9.1, 9.3, 8.3, 8.4, 8.5, 9.2, 8.8, 9.7, 10.1, 9.2)
opacity < c(4.4, 6.4, 3.0, 4.1, 0.8, 5.7, 2.0, 3.9, 1.9, 5.7,
2.8, 4.1, 3.8, 1.6, 3.4, 8.4, 5.2, 6.9, 2.7, 1.9)
Y < cbind(tear, gloss, opacity)
X < c(rep(1/n1,n1),rep(1/n2,n2))
# X: vector of contrasts: the test statistics is the difference of sampling means for all variables
A= c(1,1,1)
# array specifying the alternatives (“greater” for ‘tear’ and ‘gloss’, “less” for ‘opacity’
source("permute.r")
source("combine.r")
source("t2p.r")
set.seed(3)
T<permute(X,Y,A,B=1000)
dim(T)
# [1] 1001 3
P<t2p(T)
P[1,]
# [1] 0.994 0.014 0.252 # partial pvalues;
par(mfrow=c(1,p)) # data representation;
for(j in 1:p){boxplot(Y[,j]~X,main=colnames(Y)[j],names=c("Sample2","Sample1"))}
T1 < combine(P,fun="Fisher",which=2,W=c(0.5,0.2,0.3))
dim(T1)
#[1] 1001 1
global.p < t2p(T1)[1]
global.p
# [1] 0.248 # global pvalue.
######### ONE WAY ANOVA:
######### WAIS score example, from Mack & Wolfe (1981).
n = 3 ; C = 5;
Y = c(8.62,9.94,10.06,9.85,10.43,11.31,9.98,10.69,11.4,9.12,9.89,10.57,4.8,9.18,9.27)
X = array(0,dim=c(n*C,C))
for(k in 1:C){
X[(n*(k1)+1):(n*k),k] = 1/n
}
# X: matrix whose columns are indicator vectors of each group; the partial tests are squared sample means
x11() ; boxplot(Y~rep(1:5,each=3))
set.seed(9)
T = permute(X,Y,A = 0,B=1000)
dim(T)
# [1] 1001 5
T[1,]
# [1] 91.0116 110.8809 114.2761 97.2196 60.0625 # squared group means
T1 = combine(T,fun="Direct",which=2,W=rep(n,C)) # T1 is equivalent to the betweengroup deviance
p.glob = t2p(T1)[1]
p.glob
# [1] 0.052 # global pvalue
T1[1]  n*C*mean(Y)^2 # betweengroups deviance
#[1] 16.55796