re: Relative efficiency (RE) calculation

View source: R/re.R

reR Documentation

Relative efficiency (RE) calculation

Description

Calculate the relative efficiency (RE) between two designs, it returns same results as those from function rpe.

Usage

re(od, subod, rounded = TRUE, verbose = TRUE)

Arguments

od

Returned object of first design (e.g., unconstrained optimal design) from function od.1, od.2, od.3, od.4, od.2m, od.3m, or od.4m.

subod

Returned object of second design (e.g., constrained optimal design) from function od.1, od.2, od.3, od.4, od.2m, od.3m, or od.4m.

rounded

Logical; round the values of p, n/J/K that are from functions to two decimal places and integer, respectively if TRUE, no rounding if FALSE; default is TRUE.

verbose

Logical; print the value of relative efficiency if TRUE, otherwise not; default is TRUE.

Value

Relative efficiency value.

References

(1) Shen, Z., & Kelcey, B. (2020). Optimal sample allocation under unequal costs in cluster-randomized trials. Journal of Educational and Behavioral Statistics, 45(4): 446–474. <https://doi.org/10.3102/1076998620912418> (2) Shen, Z., & Kelcey, B. (in press). Optimal sample allocation in multisite randomized trials. The Journal of Experimental Education. <https://doi.org/10.1080/00220973.2020.1830361> (3) Shen, Z., & Kelcey, B. (in press). Optimal sampling ratios in three-level multisite experiments. Journal of Research on Educational Effectiveness.

Examples

# Unconstrained optimal design of 2-level CRT #----------
  myod1 <- od.2(icc = 0.2, r12 = 0.5, r22 = 0.5, c1 = 1, c2 = 5, c1t = 1, c2t = 50,
              varlim = c(0.01, 0.02))
# Constrained optimal design with n = 20
  myod2 <- od.2(icc = 0.2, r12 = 0.5, r22 = 0.5, c1 = 1, c2 = 5, c1t = 1, c2t = 50,
              n = 20, varlim = c(0.005, 0.025))
# Relative efficiency (RE)
  myre <- re(od = myod1, subod= myod2)
  myre$re # RE = 0.88
# Constrained optimal design with p = 0.5
  myod2 <- od.2(icc = 0.2, r12 = 0.5, r22 = 0.5, c1 = 1, c2 = 5, c1t = 1, c2t = 50,
             p = 0.5, varlim = c(0.005, 0.025))
# Relative efficiency (RE)
  myre <- re(od = myod1, subod= myod2)
  myre$re # RE = 0.90

# Unconstrained optimal design of 3-level CRT #----------
  myod1 <- od.3(icc2 = 0.2, icc3 = 0.1, r12 = 0.5, r22 = 0.5, r32 = 0.5,
             c1 = 1, c2 = 5, c3 = 25, c1t = 1, c2t = 50, c3t = 250,
             varlim = c(0.005, 0.025))
# Constrained optimal design with J = 20
  myod2 <- od.3(icc2 = 0.2, icc3 = 0.1, r12 = 0.5, r22 = 0.5, r32 = 0.5, J = 20,
             c1 = 1, c2 = 5, c3 = 25, c1t = 1, c2t = 50, c3t = 250,
             varlim = c(0, 0.025))
# Relative efficiency (RE)
  myre <- re(od = myod1, subod= myod2)
  myre$re # RE = 0.53

# Unconstrained optimal design of 4-level CRT #---------
  myod1 <- od.4(icc2 = 0.2, icc3 = 0.1, icc4 = 0.05, r12 = 0.5,
              r22 = 0.5, r32 = 0.5, r42 = 0.5,
              c1 = 1, c2 = 5, c3 = 25, c4 = 125,
              c1t = 1, c2t = 50, c3t = 250, c4t = 2500,
              varlim = c(0, 0.01))
# Constrained optimal design with p = 0.5
  myod2 <- od.4(icc2 = 0.2, icc3 = 0.1, icc4 = 0.05, r12 = 0.5, p = 0.5,
              r22 = 0.5, r32 = 0.5, r42 = 0.5,
              c1 = 1, c2 = 5, c3 = 25, c4 = 125,
              c1t = 1, c2t = 50, c3t = 250, c4t = 2500,
              varlim = c(0, 0.01))
# Relative efficiency (RE)
  myre <- re(od = myod1, subod= myod2)
  myre$re # RE = 0.78


odr documentation built on Aug. 8, 2023, 5:13 p.m.