r restricted randomisation using digger - uowweb/@inf/@math/... · r restricted randomisation using...

37
R restricted randomisation using DiGGer Neil Coombes NSW Department of Primary Industries ASEARC Conference, 2008

Upload: dinhliem

Post on 23-May-2018

231 views

Category:

Documents


2 download

TRANSCRIPT

R restricted randomisation using DiGGer

Neil Coombes

NSW Department of Primary Industries

ASEARC Conference, 2008

Outline

Searching for efficient experimental designsDesigning for Constrained ExperimentsDiGGer Design Search Package

ExamplesExample 1: Missing PlotsExample 2: 3 Block factors

Outline

Searching for efficient experimental designsDesigning for Constrained ExperimentsDiGGer Design Search Package

ExamplesExample 1: Missing PlotsExample 2: 3 Block factors

R restricted . . .

R 18+

may contain▸ violent plots▸ hanky panky▸ frequent coarse language

R restricted . . .

DiGGer packagemay contain

▸ missing plots▸ design hanky panky▸ triggers for frequent coarse language

Restrictions Precluding Standard Designs.

▸ Replication▸ unequally replicated treatments▸ unreplicated treatments

▸ Layout, one or two dimensions may be of fixed size.▸ Glasshouse, pot/bench combinations▸ Field, number of columns (ranges) usually fixed▸ Irrigation bay, limited number of rows available▸ Laboratory, sequential process - samples per day▸ Pig, digestibility samples per animal

▸ Missing plots▸ Fixed control treatment positions

Restrictions Precluding Standard Designs.

▸ Replication▸ unequally replicated treatments▸ unreplicated treatments

▸ Layout, one or two dimensions may be of fixed size.▸ Glasshouse, pot/bench combinations▸ Field, number of columns (ranges) usually fixed▸ Irrigation bay, limited number of rows available▸ Laboratory, sequential process - samples per day▸ Pig, digestibility samples per animal

▸ Missing plots▸ Fixed control treatment positions

Restrictions Precluding Standard Designs.

▸ Replication▸ unequally replicated treatments▸ unreplicated treatments

▸ Layout, one or two dimensions may be of fixed size.▸ Glasshouse, pot/bench combinations▸ Field, number of columns (ranges) usually fixed▸ Irrigation bay, limited number of rows available▸ Laboratory, sequential process - samples per day▸ Pig, digestibility samples per animal

▸ Missing plots▸ Fixed control treatment positions

Design search algorithm

Requirements:▸ Starting Design▸ Objective

▸ Blocks + Correlation▸ Optimality measure to improve (A-value), minimise average

variance of pairwise treatment comparisons▸ Search algorithm

▸ Method of change – interchange treatments▸ Rules for accepting changes▸ Rules for stopping the search

▸ maximum interchanges▸ target A-value

Warning: Check the final design.

Design search algorithm

Requirements:▸ Starting Design▸ Objective

▸ Blocks + Correlation▸ Optimality measure to improve (A-value), minimise average

variance of pairwise treatment comparisons▸ Search algorithm

▸ Method of change – interchange treatments▸ Rules for accepting changes▸ Rules for stopping the search

▸ maximum interchanges▸ target A-value

Warning: Check the final design.

Outline

Searching for efficient experimental designsDesigning for Constrained ExperimentsDiGGer Design Search Package

ExamplesExample 1: Missing PlotsExample 2: 3 Block factors

DiGGer: Object Oriented Programming Strategy in R

DiGGer requires the object oriented programming packagesR.oo and R.MethodsS3.DiGGer() creates a DiGGer object

▸ has the specifications for a search▸ made up of component objects▸ Phase component search object

▸ Objective object▸ Correlation object▸ Block object

Objects can be accessed and changed to modify the search.

DiGGer: OOPS - flowchart of design process.

Construct: DiGGer()Create the framework for a searchusing component objects

Modify: setBlock()

The DiGGer object may be viewedand modified using methods of theform getXxxx, setXxxx, addXxxxand deleteXxxx where Xxxx is acomponent of the search.

Execute: run()

Run the search, percentage ofsearch completed and the currentbest A-value are printed to showthe progess of the search

Check: plot()Check the design using graphicalplots, and tabulations.

Save: print() Save the search by printing to files

Construct: Default DiGGer() function call in R

d18 <- DiGGer(NumberOfTreatments=18,RowsInDesign=18,ColumnsInDesign=3,RowsInReplicate=NULL,ColumnsInReplicate=NULL,BlockIn2D=TRUE,Spatial=TRUE,RowColumn=TRUE,TreatmentRepeatsPerReplicate=NULL,InitialDesign=NULL,InitialSwap=NULL)

DiGGer() sets up a search which may be modified beforebeing run().

Construct: d18 description in R

INITIALISE:Seeds -1 -1 -1 -1Treatments 18 FixedLayout, Dsgn 18 x 3, Rep 18 x 3P1 PHASE: Swap 18 x 3, Corr 18 x 3

AType A++, Target 0.000000, MaxInt 10000Intensity 100.000000

O11 OBJECTIVE: Weight 0.800000Linear Covariate NONESPATIAL, Row ID(0.00) Col ID(0.00) Gamma 1.000000B111 RANDOM BLOCK: 6 Rows by 3 Columns, VarianceRatio 1.000000B112 RANDOM BLOCK: 18 Rows by 1 Column, VarianceRatio 1.000000

O12 OBJECTIVE: Weight 0.200000Linear Covariate NONESPATIAL, Row ID(0.00) Col ID(0.00) Gamma 1.000000B121 RANDOM BLOCK: 6 Rows by 1 Column, VarianceRatio 1.000000

P2 PHASE: Swap 6 x 1, Corr 18 x 3AType A++, Target 0.000000, MaxInt 100000Intensity 100.000000

O21 OBJECTIVE: Weight 1.000000Linear Covariate NONESPATIAL, Row AR(0.50) Col AR(0.50) Gamma 1.000000B211 RANDOM BLOCK: 1 Row by 3 Columns, VarianceRatio 1.000000B212 RANDOM BLOCK: 18 Rows by 1 Column, VarianceRatio 0.500000B213 RANDOM BLOCK: 1 Row by 1 Column, VarianceRatio 0.100000

Search not yet run.

DiGGer: default search strategy

Initial

swap 18 × 3

Intermediate

swap 6 × 1

Final

6 × 3 blocks

18 × 1 blocks

BlockIn2D=c(6,1)

Phase 1 search Phase 2 search

Spatial=TRUERowColumn=TRUE

1 × 3 blocks18 × 1 blocks1 × 1 blocks

AR1(0.5) rowsAR1(0.5) cols

Outline

Searching for efficient experimental designsDesigning for Constrained ExperimentsDiGGer Design Search Package

ExamplesExample 1: Missing PlotsExample 2: 3 Block factors

Eg1 Missing Plots: Design Specifications

Available plots Design Specifications:From Johnstone JABES2003

▸ 144 plots within a16 × 11 array

▸ internal missing plotsdue to failedpreparation

▸ rows represent agradation of dampnessand shade

▸ 8 treatments replicated18 times

Eg1 Missing Plots: Design Specifications

Available plots Design Specifications:From Johnstone JABES2003

▸ 144 plots within a16 × 11 array

▸ internal missing plotsdue to failedpreparation

▸ rows represent agradation of dampnessand shade

▸ 8 treatments replicated18 times

Eg1 Missing Plots: Input Matrices.

InitialSwap matrix iswap DiGGer Initialisation:▸ InitialSwap - swap

matrix coded withreplicate number

▸ use 0 for missing plots▸ treatment swaps will be

allowed between plotswith same swap code

▸ InitialDesign - allocaterandomisation of 8treatments to eachreplicate

Eg1 Missing Plots: Input Matrices.

InitialDesign matrix idsgn DiGGer Initialisation:▸ InitialSwap - swap

matrix coded withreplicate number

▸ use 0 for missing plots▸ treatment swaps will be

allowed between plotswith same swap code

▸ InitialDesign - allocaterandomisation of 8treatments to eachreplicate

Eg1 Missing Plots: DiGGer call.

d8r18 <- DiGGer(NumberOfTreatments=8,RowsInDesign=16,ColumnsInDesign=11,BlockIn2D=FALSE,InitialDesign=idsgn,InitialSwap=iswap)

plus defaults Spatial=TRUE, RowColumn=TRUE.

Eg1 Missing Plots: Final design.

RowColumn=TRUE,Spatial=TRUE

Eg1 Missing Plots: Final design.

RowColumn=TRUE,Spatial=TRUE

RowColumn=TRUE,Spatial=FALSE

Eg1 Missing Plots: Alternative Design.

DiGGer call:

d8crstdrd<- DiGGer(NumberOfTreatments=8,RowsInDesign=16,ColumnsInDesign=11,BlockIn2D=c(4,3),InitialDesign=crstart)

Eg1 Missing Plots: Alternative Design.

Final Design from CR start DiGGer call:

d8crstdrd<- DiGGer(NumberOfTreatments=8,RowsInDesign=16,ColumnsInDesign=11,BlockIn2D=c(4,3),InitialDesign=crstart)

Eg1 Missing Plots: Relative Efficiencies

Objective Model

Design Spatial RC RC no Spatial

Reps, Spatial RC 100% 96%Reps, RC (No Spatial) 91% 100%BlockIn2D, Spatial RC 97% 99%

Outline

Searching for efficient experimental designsDesigning for Constrained ExperimentsDiGGer Design Search Package

ExamplesExample 1: Missing PlotsExample 2: 3 Block factors

Eg2 Design for 3 block factors

9 treatments @ 9 replicates, optimise blocks:▸ [ 3 × 3 ] squares▸ [ 1 × 9 ] rows▸ [ 9 × 1 ] columns

Fixed treatment positions – starting gridWe call this problem Fiendish Sudoku

Eg2 Design for 3 block factors9 treatments @ 9 replicates, optimise blocks:

▸ [ 3 × 3 ] squares▸ [ 1 × 9 ] rows▸ [ 9 × 1 ] columns

Fixed treatment positions – starting gridWe call this problem Fiendish Sudoku

Eg2 Sudoku: Initial swap

Initial Swap iswap

Eg2 Sudoku: Initial swap

Initial Swap iswap Initial Design idsgn

Eg2 Sudoku: DiGGer call

DiGGer call

d9 <- DiGGer(NumberOfTreatments=9,RowsInDesign=9,ColumnsInDesign=9,RowsInReplicate=9,ColumnsInReplicate=9,BlockIn2D=c(1,1),Spatial=FALSE,RowColumn=FALSE,InitialDesign=idsgn,InitialSwap=iswap)

setMaxInterchanges(d9,phaseno=1,10000000)

setTargetAValue(d9,phaseno=1,0.2223)

Eg2 Sudoku: DiGGer call

DiGGer call

d9 <- DiGGer(NumberOfTreatments=9,RowsInDesign=9,ColumnsInDesign=9,RowsInReplicate=9,ColumnsInReplicate=9,BlockIn2D=c(1,1),Spatial=FALSE,RowColumn=FALSE,InitialDesign=idsgn,InitialSwap=iswap)

setMaxInterchanges(d9,phaseno=1,10000000)

setTargetAValue(d9,phaseno=1,0.2223)

Final Design

Eg2 Sudoku: caution

Design issues▸ DiGGer gets a valid solution▸ Sudoku doesn’t meet the design randomisation test

▸ there is one unique solution▸ restrictions on randomisation are too strict

Moral: a valid randomisation is not necessarily a valid design

Summary

DiGGer▸ is a flexible design tool.▸ handles standard and non-standard designs in a simple

way.▸ requires design checking as it is a tool.

▸ Future work▸ DiGGer in R is at its first iteration, needs some polish.▸ User supplied block/correlation structures would be useful.

Acknowledgements and References

Thanks to NSW DPI and GRDC for support in developingDiGGer.

DiGGer (licensed freeware)http://www.austatgen.org/files/software/downloads/

P. Johnstone.J.App.Biol.Env.Stat., 8:67–74, 2003.

Interactive Sudokuhttp://entertainment.timesonline.co.uk/