# Functions_for_Permutation: Helper Functions for Permutation In GlobalDeviance: Global Deviance Permutation Tests

## Description

The functions adapted from packages `globaltest` and `GlobalAncova`.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```.mchoose(counts) .nPermsG(counts, grouping) .nPerms(D.full, model.dat, formula.full) .allpermsG(counts, grouping) .allperms(nums) ```

## Arguments

 `counts` Counts. `grouping` Indices for the group. `D.full` Designmatrix from the full model. `model.dat` Dataset with covariables. `formula.full` Formula from the full model. `nums` Indices to be permuted.

## Details

The function `.mchoose` calculates the number of permutations.

The function `.nPermsG` calculates the number of permutations for multiple groups.

The function `.nPerms` calculates the number of permutations from the designmatrix.

The function `.allpermsG` lists all permutations for the multiple-group case.

The function `.allperms` lists all permutations for the continuos case.

## Value

 `.mchoose` A number. `.nPermsG` A number. `.nPerms` Number of permutations (`nPerms`) and a vector which counts same rows of the designmatrix (`counts`). `.allpermsG` A matrix. `.allperms` A matrix (`nums` x `nums`!).

## Author(s)

Frederike Fuhlbrueck [email protected]

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```## Not run: ### Examples # Number of permutations .mchoose(1:3) # or choose(sum(1:3), 1) * choose(sum(2:3), 2) # Number of permutations for multiple groups .nPermsG(1:3, c(1, 1, 2)) # Number of permutations from the designmatrix D.full<-t(matrix(c(1:9, 1:3), 3, 4)) model.dat<-matrix(c(1,0,0,1,0,1,0,0), 4, 2) colnames(model.dat)<-c("A", "B") formula.full<-~A+B .nPerms(D.full, model.dat, formula.full) # All permutations for the multiple-group case .allpermsG(c(2, 1, 2), c(1, 1, 2)) # All permutations for the continuos case .allperms(1:3) ## End(Not run) ```

GlobalDeviance documentation built on May 30, 2017, 3:01 a.m.