od.1: Optimal sample allocation calculation for single-level...

View source: R/od.1.R

od.1R Documentation

Optimal sample allocation calculation for single-level experiments detecting main effects

Description

The optimal design of single-level experiments detecting main effects is to choose the optimal sample allocation that minimizes the variance of a treatment effect under a fixed budget, which is approximately the optimal sample allocation that maximizes statistical power under a fixed budget. The optimal design parameter is the proportion of individuals to be assigned to treatment (p).

Usage

od.1(
  p = NULL,
  r12 = NULL,
  c1 = NULL,
  c1t = NULL,
  m = NULL,
  plots = TRUE,
  plim = NULL,
  varlim = NULL,
  plab = NULL,
  varlab = NULL,
  vartitle = NULL,
  verbose = TRUE
)

Arguments

p

The proportion of individuals to be assigned to treatment.

r12

The proportion of outcome variance explained by covariates.

c1

The cost of sampling one unit in control condition.

c1t

The cost of sampling one unit in treatment condition.

m

Total budget, default value is the total costs of sampling 60 individuals across treatment conditions.

plots

Logical, provide variance plots if TRUE, otherwise not; default value is TRUE.

plim

The plot range for p, default value is c(0, 1).

varlim

The plot range for variance, default value is c(0, 0.05).

plab

The plot label for p , default value is "Proportion of Individuals in Treatment: p".

varlab

The plot label for variance, default value is "Variance".

vartitle

The title of variance plot, default value is NULL.

verbose

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

Value

Unconstrained or constrained optimal sample allocation (p). The function also returns the variance of the treatment effect, function name, design type, and parameters used in the calculation.

Examples

# Unconstrained optimal design #---------
  myod1 <- od.1(r12 = 0.5, c1 = 1, c1t = 5, varlim = c(0, 0.2))
  myod1$out # output

# Constrained p, no calculation performed #---------
  myod2 <- od.1(r12 = 0.5, c1 = 1, c1t = 5, varlim = c(0, 0.2), p = 0.5)
  myod2$out
# Relative efficiency (RE)
  myre <- re(od = myod1, subod= myod2)
  myre$re # RE = 0.87

# When sampling costs are equal, a balanced  design with p = 0.5 is the best #---------
  myod3 <- od.1(r12 = 0.5, c1 = 1, c1t = 1, varlim = c(0, 0.2))
  myod3$out # output


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