mrpp.test.dist: MRPP test for one-way design

Description Usage Arguments Value Author(s) References See Also Examples

Description

K-sample MRPP test

Usage

1
2
3
4
5
6
7
mrpp.test(y, ...)
## S3 method for class 'dist'
mrpp.test(y, trt, B = as.integer(min(nparts(table(trt)), 1e4L)), permutedTrt, wtmethod=0, eps=1e-8, ...)
## S3 method for class 'formula'
mrpp.test(y, data, ...)
## Default S3 method:
mrpp.test(y, ...)

Arguments

y

A N*P data matrix, dist object of the data matrix, or a formula.

trt

A vector of treatment assignments. If missing, the first permutation in permutedTrt will be used as the original treatment assignment. As least one of trt or permutedTrt need to be given.

B

A positive integer number of permutations requested. This will only be used when permutedTrt is missing. This will be overwritten by the ncol(permutedTrt).

permutedTrt

An optional permutation index matrix. If missing, this will be computed as permuteTrt(trt,B). See permuteTrt.

wtmethod

0 or 1, where 0 stands for weighting each treatment group by sample size - 1, and 1 stands for weighting by sample size.

eps

A small non-negative number, differences below which among permuted test statistics are treated as equal.

data

A data frame in which variables in the formula can be found.

...

Additional arguments passed to the methods.

Value

An htest object with the following components:

statistic

The observed test statistic.

all.statistics

All permuted test statistics.

p.value

The permutation p-value.

parameter

A vector of the number of permutations and the weighting method.

data.name

The character name of the data.

method

A string of test method.

Author(s)

Long Qu

References

Paul W. Mielke, Kenneth J. Berry. (2007) Permutation Methods: A Distance Function Approach. 2nd ed. Springer.

See Also

permuteTrt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
set.seed(2340)
x=matrix(rnorm(20*5),20)
trt=gl(2,10)
nparts( table(trt))		## 92378 partitions =  choose(20,10)/2
urand.bigz(0,seed=1032940L) # init seed
pmat=permuteTrt(trt, 5e2L)		## use 500 random permutations
## Not run: 
pmat=permuteTrt(trt, 1e6L)		## use all partitions, as 1e6L >= 92378 

## End(Not run)
### Distance matrix interface
mrpp.test(dist(x), trt, permutedTrt=pmat, wtmethod=0 ) 

### Data matrix interface
mrpp.test(x, trt, permutedTrt=pmat, wtmethod=0 ) 

### Formula interface
dat=data.frame(x, trt)
fmla=as.formula(sprintf('cbind(%s)~trt',paste('X',1:5,sep='',collapse=',')))
mrpp.test(fmla, dat, permutedTrt=pmat, wtmethod=0 )

MRPP documentation built on May 2, 2019, 4:46 p.m.