Learn R Programming

GlobalDeviance (version 0.4)

Functions_for_Permutation: Helper Functions for Permutation

Description

The functions adapted from packages globaltest and GlobalAncova.

Usage

.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.

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!).

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.

Examples

Run this code
## 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)

Run the code above in your browser using DataLab