Learn R Programming

DesignLibrary (version 2.0.0)

factorial_designer: Create a 2^k factorial design

Description

Routes to make_design() with id "factorial": make_design("factorial", N = N, k = k, ...).

Usage

factorial_designer(
  N = 256,
  k = 3,
  outcome_means = rep(0, 2^k),
  sd = 1,
  outcome_sds = rep(sd, 2^k),
  assignment_probs = rep(0.5, k),
  outcome_name = "Y",
  treatment_names = NULL,
  args_to_fix = NULL
)

Value

A design object.

Arguments

N

Sample size.

k

Number of factors, an integer of at least 2.

outcome_means

Mean outcome in each of the 2^k treatment combinations.

sd

Standard deviation of every potential outcome, used when outcome_sds is not supplied.

outcome_sds

Standard deviation of the outcome in each of the 2^k treatment combinations.

assignment_probs

Probability of assignment to each factor (length k).

outcome_name

Name of the outcome variable.

treatment_names

Names of the k factors. NULL gives T1, ..., Tk.

args_to_fix

Ignored. Present for compatibility with DesignLibrary 0.1.

Details

Each of k factors is assigned with its own probability, and each of the 2^k treatment combinations has its own normally distributed potential outcome. The inquiries are the overall average, the average effect of each factor, and every interaction, each averaged with equal weight over the conditions of the other factors. The estimator regresses the outcome on the full interaction of the treatments centered at 0.5, weighted by the inverse probability of the assigned combination, so the intercept estimates the overall average and each coefficient an average effect. Argument names match DesignLibrary 0.1's factorial_designer.

outcome_means and outcome_sds follow the row order of expand.grid(rep(list(c(0, 1)), k)), in which the first factor varies fastest.

See Also

make_design()

Examples

Run this code
factorial_designer(k = 3, assignment_probs = c(1/2, 1/4, 1/8),
                   outcome_means = c(0, 0, 0, 0, 0, 0, 0, 4))

Run the code above in your browser using DataLab