Learn R Programming

predictmeans (version 1.0.9)

permindex: Permutation Index

Description

This function obtains permutation index for a dataset.

Usage

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

Value

A matrix has 'nsim' columns of permuted index.

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.

Author

Dongwen Luo, Siva Ganesh and John Koolaard

Examples

Run this code
  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.

Run the code above in your browser using DataLab