# treeperm: Permutation Tests Using Tree Algorithms In treeperm: Exact and Asymptotic K Sample Permutation Test

## Description

This function will perform a K samnple permutation test of data locations. Users may choose either asymptotic test or exact test.

## Usage

 ```1 2 3 4 5 6 7 8``` ```## S3 method for class 'formula' treeperm(formula, frame = list(), type, size, ...) ## Default S3 method: treeperm(x,data,factor, type, size, ...) ## S3 method for class 'treeperm' print(x,...) ## S3 method for class 'treeperm' summary(object,...) ```

## Arguments

 `x` Generic argument, used only in print.treeperm to represent the treeperm class. `formula` The formula to perform permutation test. The form should be value~label, where value is the set of data and label classifies value into groups. `frame` The dataframe storing vectors used in formula. `data` The data set to be permuted `factor` The index set that classifies parameter data into groups. `type` Which type of permutation the user want to use, either 'exact' or 'approximate'. `size` If the type is 'approximate', user must specify the size of permutations they want. `object` The treeperm class to be summarised. `...` Reserved for future.

## Details

This function calls KPermutation or Permutation depending on the levels of factor.

## Value

 `result` A permutation object returned by a permutation function, either class Permutation or class KPermutation depending the levels of argument factor. `call` User's calling script to this function at highest level. `data` The input data set. `factor` The index set that classifies data into groups.

## Author(s)

Qiao

 ```1 2 3 4 5 6 7``` ```value<-c(0,190,0,0,10,0,0,0,0,0,0,110,0,0,52,0,8,0,50,0,0,137,965,110) label<-as.factor(c(1,1,1,2,2,2,1,1,1,2,2,2,1,1,1,2,2,2,1,1,1,2,2,2)) data<-data.frame(label,value) exact<-treeperm(value~label,frame=data,type="exact") summary(exact) approximate<-treeperm(value~label,frame=data,type="approximate",size=999) summary(approximate) ```