seq_combs: All compatible treatment combination cross-over design...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/seq_combs.R

Description

Specifies cross-over designs based on all possible compatible treatment combinations.

Usage

1
2
seq_combs(D = 2, J = D, max_occurrences = 1, max_repetitions = 1,
  labels = 0:(D - 1), as_matrix = T, summary = T)

Arguments

D

The number of treatments. Must be a single numeric integer greater than or equal to three. Defaults to 2.

J

The number of periods. Must be a single numeric integer greater than or equal to two. Defaults to D.

max_occurrences

The maximal number of times a treatment can be allocated in any sequence. Must be a single numeric integer between one and J inclusive. Defaults to 1.

labels

A vector of labels for the treatments. Should be of length D, containing unique elements. Defaults to 0:(D - 1).

as_matrix

A logical variable indicating whether the design should be returned as a matrix, or a tibble. Defaults to T.

summary

A logical variable indicating whether a summary of the function's progress should be printed to the console. Defaults to T.

max_repetititions

The maximal number of times a treatment can be repeatedly allocated in any sequence. Must be a single numeric integer between one and max_occurrences inclusive. Defaults to 1.

Details

seq_combs() supports the specification of designs based on all possible compatible treatment combinations for a given number of treatments and periods. Designs for any number of treatments (see D) and periods (see J) are supported, for any chosen treatment labels (see labels). In addition, the designs can be returned in matrix or tibble form (see as_matrix).

Precisely, all possible combinations of D treatments across J periods are determined, subject to the specified restrictions on the maximal number of times a treatment can appear in a sequence (see max_occurrences), and the maximal number of sequential periods a treatment can be repeatedly allocated in (see max_repetitions). Ultimately, the (k,j)th element of the cross-over design matrix corresponds to the treatment a subject on the kth sequence would receive in the jth period.

Value

NULL if no compatible sequence exists. Otherwise, a matrix if as_matrix = T (with rows corresponding to sequences and columns to periods), or a tibble if as_matrix = F (with rows corresponding to a particular period on a particular sequence). In either case, the returned object will have class xover_seq.

Author(s)

Based on code from the crossdes package by Oliver Sailer.

References

Jones B, Kenward MG (2014) Design and Analysis of Cross-Over Trials. Chapman and Hall: London, 3rd Edition.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Two-treatment two-period and three-treatment three-period designs, with
# maximal one allocation to a treatment
two_by_two            <- seq_combs(D = 2)
three_by_three        <- seq_combs(D = 3)
# Using different labels
two_by_two_AB         <- seq_combs(D = 2, labels = c("A", "B"))
three_by_three_ABC    <- seq_combs(D = 3, labels = c("A", "B", "C"))
# Returning in tibble form
two_by_two_tibble     <- seq_combs(D = 2, as_matrix = F)
three_by_three_tibble <- seq_combs(D = 3, as_matrix = F)

mjg211/xover documentation built on Oct. 16, 2019, 10:46 a.m.