permindex: Permutation Index

View source: R/permindex.R

permindexR Documentation

Permutation Index

Description

This function obtains permutation index for a dataset.

Usage

permindex(data, block=NULL, group=NULL, nsim=4999, seed)

Arguments

data

Data object used in the model fitting.

block

Name (in "quotes") for the blocking factor in the data.

group

Name (in "quotes") for the group factor in the data.

nsim

The number of permutations. The default is 4999.

seed

Specify a random number generator seed, for reproducible results.

Value

A matrix has 'nsim' columns of permuted index.

Author(s)

Dongwen Luo, Siva Ganesh and John Koolaard

Examples

  library(predictmeans)
  block <- rep(1:3, each=12)
  group <- rep(rep(1:3, each=4), 3)
  data <- data.frame(block, group)
  cbind(data, permindex(data, block="block", group="group", nsim=5))  
                        # Permute group as a whole within each block first, 
                        # then permute obs within each group.
  cbind(data, permindex(data, block="block",  nsim=5)) 
                        # Permute obs within each block only.
  cbind(data, permindex(data, group="group", nsim=5)) 
                        # Permute groups as a whole block first, 
                        # then permute obs within each group.
  cbind(data, permindex(data, nsim=5))  # Free permutation.

predictmeans documentation built on May 29, 2024, 9:49 a.m.