| Title: | Optimal Row-Column Designs for Asymmetrical Factorial Experiments |
|---|---|
| Description: | Constructs and analyzes optimal row-column designs for mixed-level factorial experiments under square and rectangular field layouts. For square field layouts, the package implements direct common-factor constructions by first forming two component treatment arrays, one for each factor or super-factor, and then combining them through a symbolic cell-wise product following Gopinath, Parsad and Mandal (2018) <doi:10.1080/03610926.2017.1376091>. For rectangular field layouts, the package constructs designs by extracting a balanced principal block from a mixed-level block design, treating it as the principal column, taking the complete treatment set as the principal row, and generating the full row-column design by cyclic modular development. The package also includes repair utilities for improving disconnected or partially connected row-column designs through bounded treatment-swap searches while preserving the row-column layout structure. The package provides diagnostic tools for connectedness, orthogonal factorial structure, balance, estimability, and selected optimality criteria for row-column designs. |
| Authors: | Archana A [aut], Sukanta Dash [aut, cre] |
| Maintainer: | Sukanta Dash <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-05-11 10:43:20 UTC |
| Source: | https://github.com/cran/MFRCD |
Analyze a factorial row-column design.
analyse_rcd( design, factor_levels = NULL, input = c("auto", "number", "factor_label"), sep = "", tol = 1e-08 )analyse_rcd( design, factor_levels = NULL, input = c("auto", "number", "factor_label"), sep = "", tol = 1e-08 )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
tol |
Numerical tolerance. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- analyse_rcd(D, factor_levels = c(2, 2), input = "number") stopifnot(inherits(res, "rcd_analysis"))D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- analyse_rcd(D, factor_levels = c(2, 2), input = "number") stopifnot(inherits(res, "rcd_analysis"))
Check basic row-column factorial design properties.
check_rc_factorial_n(D)check_rc_factorial_n(D)
D |
A design object or design matrix. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
ex <- rc_factorial_n(c(2, 2)) chk <- check_rc_factorial_n(ex) stopifnot(is.list(chk))ex <- rc_factorial_n(c(2, 2)) chk <- check_rc_factorial_n(ex) stopifnot(is.list(chk))
Repair a row-column design under bounded swaps.
make_connected_rcd_bounded( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", tol = 1e-08, replication = "auto", horizontal_reps = 1, vertical_reps = 1, max_per_row = horizontal_reps, max_per_column = vertical_reps, max_iter = 100, max_candidates = NULL, seed = NULL, verbose = FALSE )make_connected_rcd_bounded( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", tol = 1e-08, replication = "auto", horizontal_reps = 1, vertical_reps = 1, max_per_row = horizontal_reps, max_per_column = vertical_reps, max_iter = 100, max_candidates = NULL, seed = NULL, verbose = FALSE )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
tol |
Numerical tolerance. |
replication |
Replication target or "auto". |
horizontal_reps |
Maximum horizontal replication bound. |
vertical_reps |
Maximum vertical replication bound. |
max_per_row |
Maximum allowed occurrences of a treatment in a row. |
max_per_column |
Maximum allowed occurrences of a treatment in a column. |
max_iter |
Maximum number of repair iterations. |
max_candidates |
Maximum number of candidate swaps to examine. |
seed |
Optional random seed. |
verbose |
Logical; if TRUE, emit progress or summary messages. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- make_connected_rcd_bounded( D, factor_levels = c(2, 2), input = "number", max_iter = 1, max_candidates = 5 ) stopifnot(is.list(res))D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- make_connected_rcd_bounded( D, factor_levels = c(2, 2), input = "number", max_iter = 1, max_candidates = 5 ) stopifnot(is.list(res))
Create a D2 design from complete treatment sets.
make_D2_from_complete_sets( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", prefer_margin = c("rows", "columns"), tol = 1e-08, max_solutions_checked = 100000L, treatment_universe = c("auto", "factorial", "observed") )make_D2_from_complete_sets( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", prefer_margin = c("rows", "columns"), tol = 1e-08, max_solutions_checked = 100000L, treatment_universe = c("auto", "factorial", "observed") )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
prefer_margin |
Preferred margin for complete-set reshuffling. |
tol |
Numerical tolerance. |
max_solutions_checked |
Maximum number of candidate partitions to check. |
treatment_universe |
Treatment universe used for connectedness and repair. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- mfrcd(c(2, 2)) res <- make_D2_from_complete_sets(D, factor_levels = c(2, 2)) stopifnot(is.list(res))D <- mfrcd(c(2, 2)) res <- make_D2_from_complete_sets(D, factor_levels = c(2, 2)) stopifnot(is.list(res))
Generate a mixed-level factorial row-column design.
mfrcd( levels, block_size = NULL, sep = "", details = FALSE, check_properties = FALSE, use_mixedfact = TRUE, mixedfact_method = "auto", choose_block = "best", group1 = NULL, group2 = NULL, prefer = c("auto", "direct", "mixedfact"), tol = 1e-07 )mfrcd( levels, block_size = NULL, sep = "", details = FALSE, check_properties = FALSE, use_mixedfact = TRUE, mixedfact_method = "auto", choose_block = "best", group1 = NULL, group2 = NULL, prefer = c("auto", "direct", "mixedfact"), tol = 1e-07 )
levels |
Integer vector of factor levels. |
block_size |
Block size used in the construction. |
sep |
Character separator used in treatment labels. |
details |
Logical; if TRUE, return construction details. |
check_properties |
Logical; if TRUE, compute design-property diagnostics. |
use_mixedfact |
Logical; if TRUE, allow the mixedfact-based construction route. |
mixedfact_method |
Method passed to mixedfact when that route is used. |
choose_block |
Rule for choosing a block when several are available. |
group1 |
Optional integer vector of factor indices in the first group. |
group2 |
Optional integer vector of factor indices in the second group. |
prefer |
Construction route preference. |
tol |
Numerical tolerance. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
d <- mfrcd(c(2, 2)) stopifnot(is.matrix(d))d <- mfrcd(c(2, 2)) stopifnot(is.matrix(d))
Generate, check, and optionally repair an MFRCD design.
mfrcd_check_repair( levels, block_size = NULL, sep = "", use_mixedfact = TRUE, mixedfact_method = "auto", choose_block = "best", group1 = NULL, group2 = NULL, prefer = c("auto", "direct", "mixedfact"), tol = 1e-08, repair_if_disconnected = TRUE, replication = "auto", horizontal_reps = NULL, vertical_reps = NULL, max_per_row = NULL, max_per_column = NULL, max_iter = 100, max_candidates = NULL, seed = NULL, complete_set_prefer = c("rows", "columns"), max_complete_set_search = 100000L, treatment_universe = c("auto", "factorial", "observed"), verbose = FALSE )mfrcd_check_repair( levels, block_size = NULL, sep = "", use_mixedfact = TRUE, mixedfact_method = "auto", choose_block = "best", group1 = NULL, group2 = NULL, prefer = c("auto", "direct", "mixedfact"), tol = 1e-08, repair_if_disconnected = TRUE, replication = "auto", horizontal_reps = NULL, vertical_reps = NULL, max_per_row = NULL, max_per_column = NULL, max_iter = 100, max_candidates = NULL, seed = NULL, complete_set_prefer = c("rows", "columns"), max_complete_set_search = 100000L, treatment_universe = c("auto", "factorial", "observed"), verbose = FALSE )
levels |
Integer vector of factor levels. |
block_size |
Block size used in the construction. |
sep |
Character separator used in treatment labels. |
use_mixedfact |
Logical; if TRUE, allow the mixedfact-based construction route. |
mixedfact_method |
Method passed to mixedfact when that route is used. |
choose_block |
Rule for choosing a block when several are available. |
group1 |
Optional integer vector of factor indices in the first group. |
group2 |
Optional integer vector of factor indices in the second group. |
prefer |
Construction route preference. |
tol |
Numerical tolerance. |
repair_if_disconnected |
Logical; if TRUE, attempt repair when the design is disconnected. |
replication |
Replication target or "auto". |
horizontal_reps |
Maximum horizontal replication bound. |
vertical_reps |
Maximum vertical replication bound. |
max_per_row |
Maximum allowed occurrences of a treatment in a row. |
max_per_column |
Maximum allowed occurrences of a treatment in a column. |
max_iter |
Maximum number of repair iterations. |
max_candidates |
Maximum number of candidate swaps to examine. |
seed |
Optional random seed. |
complete_set_prefer |
Preferred direction for complete-set reshuffling. |
max_complete_set_search |
Maximum number of complete-set partitions to inspect. |
treatment_universe |
Treatment universe used for connectedness and repair. |
verbose |
Logical; if TRUE, emit progress or summary messages. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
res <- mfrcd_check_repair(c(2, 2), repair_if_disconnected = FALSE, max_iter = 1, max_candidates = 5) stopifnot(inherits(res, "mfrcd_check_repair"))res <- mfrcd_check_repair(c(2, 2), repair_if_disconnected = FALSE, max_iter = 1, max_candidates = 5) stopifnot(inherits(res, "mfrcd_check_repair"))
Print an MFRCD check-and-repair result.
## S3 method for class 'mfrcd_check_repair' print(x, ...)## S3 method for class 'mfrcd_check_repair' print(x, ...)
x |
An object. |
... |
Additional arguments passed to or from methods. |
Invisibly returns 'x'.
res <- mfrcd_check_repair(c(2, 2), repair_if_disconnected = FALSE, max_iter = 1, max_candidates = 5) print(res)res <- mfrcd_check_repair(c(2, 2), repair_if_disconnected = FALSE, max_iter = 1, max_candidates = 5) print(res)
Print a row-column design analysis.
## S3 method for class 'rcd_analysis' print(x, digits = 6, ...)## S3 method for class 'rcd_analysis' print(x, digits = 6, ...)
x |
An object. |
digits |
Number of digits used for printing. |
... |
Additional arguments passed to or from methods. |
Invisibly returns 'x'.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- analyse_rcd(D, factor_levels = c(2, 2), input = "number") print(res)D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- analyse_rcd(D, factor_levels = c(2, 2), input = "number") print(res)
Construct a mixed-level factorial row-column design.
rc_factorial_n(levels, sep = "", details = FALSE, group1 = NULL, group2 = NULL)rc_factorial_n(levels, sep = "", details = FALSE, group1 = NULL, group2 = NULL)
levels |
Integer vector of factor levels. |
sep |
Character separator used in treatment labels. |
details |
Logical; if TRUE, return construction details. |
group1 |
Optional integer vector of factor indices in the first group. |
group2 |
Optional integer vector of factor indices in the second group. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
ex <- rc_factorial_n(c(2, 2)) stopifnot(is.matrix(ex))ex <- rc_factorial_n(c(2, 2)) stopifnot(is.matrix(ex))
Construct a row-column design from a principal block.
rc_from_principal_block( levels, block_size, principal_block = NULL, use_mixedfact = TRUE, mixedfact_method = "auto", choose_block = "best", sep = "", details = FALSE )rc_from_principal_block( levels, block_size, principal_block = NULL, use_mixedfact = TRUE, mixedfact_method = "auto", choose_block = "best", sep = "", details = FALSE )
levels |
Integer vector of factor levels. |
block_size |
Block size used in the construction. |
principal_block |
Optional principal block of treatment labels. |
use_mixedfact |
Logical; if TRUE, allow the mixedfact-based construction route. |
mixedfact_method |
Method passed to mixedfact when that route is used. |
choose_block |
Rule for choosing a block when several are available. |
sep |
Character separator used in treatment labels. |
details |
Logical; if TRUE, return construction details. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
pb <- matrix(c(0, 0, 0, 1), ncol = 2, byrow = TRUE) ex <- rc_from_principal_block(c(2, 2), block_size = 2, principal_block = pb, details = TRUE) stopifnot(is.matrix(ex$design))pb <- matrix(c(0, 0, 0, 1), ncol = 2, byrow = TRUE) ex <- rc_from_principal_block(c(2, 2), block_size = 2, principal_block = pb, details = TRUE) stopifnot(is.matrix(ex$design))
Construct a two-factor row-column design using Method 1.
rc_method1(s1, s2, f = NULL, sep = "")rc_method1(s1, s2, f = NULL, sep = "")
s1 |
Number of levels for the first factor or factor group. |
s2 |
Number of levels for the second factor or factor group. |
f |
Common factor used by Method 1. |
sep |
Character separator used in treatment labels. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
ex <- rc_method1(2, 4) stopifnot(is.matrix(ex$design))ex <- rc_method1(2, 4) stopifnot(is.matrix(ex$design))
Construct a two-factor row-column design using Method 2.
rc_method2(s1, s2, sep = "")rc_method2(s1, s2, sep = "")
s1 |
Number of levels for the first factor or factor group. |
s2 |
Number of levels for the second factor or factor group. |
sep |
Character separator used in treatment labels. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
ex <- rc_method2(2, 4) stopifnot(is.matrix(ex$design))ex <- rc_method2(2, 4) stopifnot(is.matrix(ex$design))
Summarize row-column design analysis.
rcd_analysis_summary(ans)rcd_analysis_summary(ans)
ans |
Analysis result. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) ans <- analyse_rcd(D, factor_levels = c(2, 2), input = "number") res <- rcd_analysis_summary(ans) stopifnot(is.data.frame(res))D <- matrix(c(1, 2, 3, 4), nrow = 2) ans <- analyse_rcd(D, factor_levels = c(2, 2), input = "number") res <- rcd_analysis_summary(ans) stopifnot(is.data.frame(res))
Check feasibility of a row-column design.
rcd_feasibility_check( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", tol = 1e-08 )rcd_feasibility_check( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", tol = 1e-08 )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
tol |
Numerical tolerance. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- rcd_feasibility_check(D, factor_levels = c(2, 2), input = "number") stopifnot(is.list(res))D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- rcd_feasibility_check(D, factor_levels = c(2, 2), input = "number") stopifnot(is.list(res))
Summarize a row-column design layout.
summarize_rcd_layout( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "" )summarize_rcd_layout( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "" )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- summarize_rcd_layout(D, factor_levels = c(2, 2), input = "number") stopifnot(is.list(res)) stopifnot(is.data.frame(res$total_replication_by_treatment))D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- summarize_rcd_layout(D, factor_levels = c(2, 2), input = "number") stopifnot(is.list(res)) stopifnot(is.data.frame(res$total_replication_by_treatment))
Check connectedness of a row-column design.
tetra_connectedness( design, factor_levels = NULL, input = c("auto", "number", "factor_label"), sep = "", tol = 1e-08 )tetra_connectedness( design, factor_levels = NULL, input = c("auto", "number", "factor_label"), sep = "", tol = 1e-08 )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
tol |
Numerical tolerance. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- tetra_connectedness(D, factor_levels = c(2, 2), input = "number") stopifnot(is.logical(res$connected))D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- tetra_connectedness(D, factor_levels = c(2, 2), input = "number") stopifnot(is.logical(res$connected))
Validate row-column replication bounds.
validate_bounded_rcd( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", replication = "auto", max_per_row = 1, max_per_column = 1 )validate_bounded_rcd( design, factor_levels, input = c("factor_label", "number", "auto"), sep = "", replication = "auto", max_per_row = 1, max_per_column = 1 )
design |
A row-column design matrix. |
factor_levels |
Integer vector of factor levels. |
input |
Coding used by the supplied design. |
sep |
Character separator used in treatment labels. |
replication |
Replication target or "auto". |
max_per_row |
Maximum allowed occurrences of a treatment in a row. |
max_per_column |
Maximum allowed occurrences of a treatment in a column. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- validate_bounded_rcd(D, factor_levels = c(2, 2), input = "number") stopifnot(is.list(res))D <- matrix(c(1, 2, 3, 4), nrow = 2) res <- validate_bounded_rcd(D, factor_levels = c(2, 2), input = "number") stopifnot(is.list(res))
Verify a mixed-level factorial row-column design.
verify_mfrcd( x, levels = NULL, sep = "", tol = 1e-07, max_order = NULL, verbose = FALSE )verify_mfrcd( x, levels = NULL, sep = "", tol = 1e-07, max_order = NULL, verbose = FALSE )
x |
An object. |
levels |
Integer vector of factor levels. |
sep |
Character separator used in treatment labels. |
tol |
Numerical tolerance. |
max_order |
Maximum factorial effect order to include. |
verbose |
Logical; if TRUE, emit progress or summary messages. |
A list, matrix, data frame, or classed object containing the requested row-column design information.
d <- mfrcd(c(2, 2), details = TRUE, check_properties = FALSE) res <- verify_mfrcd(d, levels = c(2, 2)) stopifnot(is.list(res))d <- mfrcd(c(2, 2), details = TRUE, check_properties = FALSE) res <- verify_mfrcd(d, levels = c(2, 2)) stopifnot(is.list(res))