# \donttest{
## NOTE TO USERS:
## Some examples below need Unicode symbols (e.g., "u2297 and "u2192"
## with a backslash, for the Kronecker and arrow symbols respectively),
## but we use ASCII fallbacks such as "x" and "->" in the code to ensure
## compatibility across systems.
## To render proper Unicode symbols in diagrams, update the labels manually
## i.e., x to \ u2297 to get the Kronecker symbol and -> to \ u2192 to get the
## arrow symbol, and set a Unicode-friendly font via the hasse.font argument.
## See the hasse.font argument and Details section in ?hasserls for guidance.
## Example: Asphalt concrete production (fractional factorial design)
concrete_objects <- itemlist(datadesign = concrete)
concrete_rls <- concrete_objects$TransferObject
concrete_rls[, 2] <- concrete_rls[, 1]
concrete_rls[27, 2] <- "AC^AG^CC^CoT^CuT -> Run"
hasserls(object = concrete_objects,
randomisation.objects = concrete_rls,
larger.fontlabelmultiplier = 1.6,
smaller.fontlabelmultiplier = 1.3,
table.out = "Y", arrow.pos = 8,
hasse.font = "sans")
## Example: Crossover dental study
dental_objects <- itemlist(datadesign = dental, randomfacsid = c(0,1,0,0,0))
dental_rand_arrows <- matrix(c(3, 5, 4, 7), ncol = 2, byrow = TRUE)
dental_rls <- dental_objects$TransferObject
dental_rls[c(1:5,7,8), 2] <- c("Mean", "Period", "Sequence",
"Treatment", "Subject[Sequence]",
"Period x Sequence",
"Observation")
hasserls(object = dental_objects,
randomisation.objects = dental_rls,
random.arrows = dental_rand_arrows,
larger.fontlabelmultiplier = 1.6,
table.out = "Y", equation.out = "Y",
arrow.pos = 15, hasse.font = "sans")
## Example: Human-computer interaction study
human_objects <- itemlist(datadesign = human,
randomfacsid = c(1,1,0,0,0,0,1))
human_rand_arrows <- matrix(c(3, 12, 6, 13), ncol = 2, byrow = TRUE)
human_rls <- human_objects$TransferObject
human_rls[, 2] <- c("Mean", "Day", "Method", "Period", "Room", "Sequence",
"NULL", "Subject | Subject -> Day x Sequence",
"NULL", "NULL", "NULL", "Day x Room",
"Period x Room", "NULL",
"Test = Day^Method^Period^Room^Sequence")
hasserls(object = human_objects,
randomisation.objects = human_rls,
random.arrows = human_rand_arrows,
larger.fontlabelmultiplier = 1.4,
hasse.font = "sans")
## Example: Analytical method (cross-nested design)
analytical_objects <- itemlist(datadesign = analytical,
randomfacsid = c(0,0,1,1,1,0,0,0))
analytical_rand_arrows <- matrix(c(2, 19, 19, 20), ncol = 2, byrow = TRUE)
analytical_rls <- analytical_objects$TransferObject
analytical_rls[, 2] <- c("Mean", "Batch", "Site",
"Analyst[Site]", "Column[Site]",
"System[Site]", "NULL",
"{Analyst^Column}[Site]",
"{Analyst^System}[Site]", "NULL",
"{Column^System}[Site]",
"NULL", "NULL",
"{Analyst^Column^System}[Site] -> Run",
"NULL", "NULL", "NULL", "NULL",
"Preparation[Run]", "Injection[Run]")
hasserls(object = analytical_objects,
randomisation.objects = analytical_rls,
random.arrows = analytical_rand_arrows,
showpartialRLS = "N", check.confound.df = "N",
larger.fontlabelmultiplier = 1,
smaller.fontlabelmultiplier = 1.6,
hasse.font = "sans")
## Conditionally run examples requiring 'dae'
if (requireNamespace("dae", quietly = TRUE)) {
data(BIBDWheat.dat, package = "dae")
BIBDWheat <- BIBDWheat.dat[, -4]
BIBDWheat$Plots <- 1:30
BIBDWheat_objects <- itemlist(datadesign = BIBDWheat)
IBDWheat_rand_arrows <- matrix(c(3, 4), ncol = 2, byrow = TRUE)
IBDWheat_rls <- BIBDWheat_objects$TransferObject
IBDWheat_rls[1:4, 2] <- c("Mean", "Blocks", "Varieties", "Plot[Block]")
hasserls(object = BIBDWheat_objects,
randomisation.objects = IBDWheat_rls,
random.arrows = IBDWheat_rand_arrows,
equation.out = "Y")
data(Fac4Proc.dat, package = "dae")
Fac4Proc <- Fac4Proc.dat[, -6]
Fac4Proc_objects <- itemlist(datadesign = Fac4Proc)
Fac4Proc_rls <- Fac4Proc_objects$TransferObject
Fac4Proc_rls[, 2] <- Fac4Proc_rls[, 1]
Fac4Proc_rls[16, 2] <- "Catal^Conc^Press^Temp -> Run"
hasserls(object = Fac4Proc_objects,
randomisation.objects = Fac4Proc_rls,
showpartialRLS = "N", table.out = "Y",
smaller.fontlabelmultiplier = 2,
hasse.font = "sans")
data(Casuarina.dat, package = "dae")
Casuarina <- Casuarina.dat[, -7]
Casuarina$Row <- paste(Casuarina$Reps, Casuarina$Rows)
Casuarina$Col <- paste(Casuarina$Reps, Casuarina$Columns)
Casuarina <- Casuarina[, -c(2, 3)]
Casuarina_objects <- itemlist(datadesign = Casuarina,
randomfacsid = c(1,0,1,0,0,0))
Casuarina_rand_objects <- c(1:6, 9, 13)
Casuarina_rand_arrows <- matrix(c(3, 5, 4, 13), ncol = 2, byrow = TRUE)
Casuarina_rls <- Casuarina_objects$TransferObject
Casuarina_rls[Casuarina_rand_objects, 2] <- c("Mean", "Countries",
"InocTime", "Provences",
"Reps", "Countries^InocTime",
"Inoc^Provences",
"{Row x Col}[Rep]")
hasserls(object = Casuarina_objects,
randomisation.objects = Casuarina_rls,
random.arrows = Casuarina_rand_arrows,
check.confound.df = "N", showpartialRLS = "N",
arrow.pos = 10,
smaller.fontlabelmultiplier = 1.5,
hasse.font = "sans")
} else {
message("Install package 'dae' to run the final examples.")
}
# }
Run the code above in your browser using DataLab