optimal.shuffle: optimal.shuffle

Description Usage Arguments Details Value See Also Examples

View source: R/gSetup-class.R

Description

Optimize a sample assingment setup by shuffling.

Usage

1
optimal.shuffle(x, nSim, k)

Arguments

x

A gExperimentSetup object.

nSim

Number of shuffling steps.

k

Number of samples been shuffled. Default k=2 when omitted..

Details

Given any gExperimentSetup object, we randomly select k samples from different batches and shuffle them between batches to create a new sample assignment. k = 2 by default but could be any number up to half of the sample size. Value of the objective function is calculated on the new setup and compared to that of the original one. If the value is smaller then the new assignment replaces the previous one. This procedure will continue until we reach a preset number of attempts (usually in the tens of thousands).

Value

A class gExperimentSetup object, after optimized.

See Also

optimal.block

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library("OSAT")
# data as an example
inPath <- system.file("extdata", package="OSAT")
pheno <- read.table(file.path(inPath, 'samples.txt'), header=TRUE, sep="\t")

## create object to hold sample information
gs <- setup.sample(pheno,  optimal=c("SampleType", "Race", "AgeGrp"), strata=c("SampleType") )
gs

gc <- setup.container(IlluminaBeadChip96Plate, 6, batch='plates')
gc

gSetup0 <- create.experiment.setup(sample=gs, container=gc)
# demonstration only. nSim=5000 or more are commonly used.
g3 <- optimal.shuffle(gSetup0, nSim=500, k=2)

llrs/OSAT documentation built on May 23, 2019, 7:18 a.m.