# K Sample Exact Permutation Test

### Description

This function performs a K sample permutation test of data locations by returning a p value. It is a wrapper function for C level computations. Although it supports two sample permutation test, users should really use the Permutation function because it is much faster in handling two sample case. Users are not expected to use this function directly because there is no error checking mechanisms. However, for purpose of performance testing and other demands, this function is visible in this package.

### Usage

1 2 3 | ```
KPermutation(data, factor)
## S3 method for class 'KPermutation'
print(x,...)
``` |

### Arguments

`x` |
The KPermutation class to be printed. |

`data` |
The set of all data to be permuted |

`factor` |
The set of indices, indicating group assignments of values in vector data. This parameter should be in factor type. |

`...` |
Reserved for future. |

### Details

Details about implementations are located in KPermutation.c.

### Value

`Statistics ` |
The observed test statistics for input data. F statistics is used in this case. |

`Permutations ` |
The total number of permutations can be performed on input groups. |

`pvalue ` |
The p value of this two sample permutation test. |

### Note

Although the return value contains F statistics, the actual computation uses a reduced statistics to speed up computation.

### Author(s)

Qiao Kang

### References

Ernst M. D 2004, 'Permutation Methods: A Basis for Exact Inference', Statistical Science, Vol. 19, No. 4, p 676-685

### Examples

1 2 3 4 5 6 7 8 9 10 11 | ```
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))
print(KPermutation(value,label))
function (data, factor)
{
factor <- as.factor(factor)
p <- .Call("calculate_K_pvalue", data, as.integer(factor))
result <- list(Fstatistics = p[3], Permutations = p[2], pvalue = p[1])
class(result) <- "KPermutation"
result
}
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.