Description Usage Arguments Details Value Author(s) Examples

View source: R/block_cluster_two_arm_designer.R

Builds a two-arm design with blocks and clusters.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
block_cluster_two_arm_designer(
N = NULL,
N_blocks = 1,
N_clusters_in_block = ifelse(is.null(N), 100, round(N/N_blocks)),
N_i_in_cluster = ifelse(is.null(N), 1, round(N/mean(N_blocks * N_clusters_in_block))),
sd = 1,
sd_block = 0.5773 * sd,
sd_cluster = max(0, (sd^2 - sd_block^2)/2)^0.5,
sd_i_0 = max(0, sd^2 - sd_block^2 - sd_cluster^2)^0.5,
sd_i_1 = sd_i_0,
rho = 1,
assignment_probs = 0.5,
control_mean = 0,
ate = 0,
treatment_mean = control_mean + ate,
verbose = TRUE,
args_to_fix = NULL
)
``` |

`N` |
An integer. Total number of units. Usually not specified as |

`N_blocks` |
An integer. Number of blocks. Defaults to 1 for no blocks. |

`N_clusters_in_block` |
An integer or vector of integers of length |

`N_i_in_cluster` |
An integer or vector of integers of length |

`sd` |
A nonnegative number. Overall standard deviation (combining individual level, cluster level, and block level shocks). Defaults to 1. Overridden if incompatible with other user-specified shocks. |

`sd_block` |
A nonnegative number. Standard deviation of block level shocks. |

`sd_cluster` |
A nonnegative number. Standard deviation of cluster level shock. |

`sd_i_0` |
A nonnegative number. Standard deviation of individual level shock in control. If not specified, and when possible given |

`sd_i_1` |
A nonnegative number. Standard deviation of individual level shock in treatment. Defaults to |

`rho` |
A number in [-1,1]. Correlation in individual shock between potential outcomes for treatment and control. |

`assignment_probs` |
A number or vector of numbers in (0,1). Treatment assignment probability for each block (specified in order of |

`control_mean` |
A number. Average outcome in control. |

`ate` |
A number. Average treatment effect. Alternative to specifying |

`treatment_mean` |
A number. Average outcome in treatment. If |

`verbose` |
Logical. If TRUE, prints intra-cluster correlation implied by design parameters. |

`args_to_fix` |
A character vector. Names of arguments to be args_to_fix in design. |

Units are assigned to treatment using complete block cluster random assignment. Treatment effects can be specified either by providing `control_mean`

and `treatment_mean`

or by specifying an `ate`

. Estimation uses differences in means accounting for blocks and clusters.

In the usual case `N`

is not provided by the user but is determined by `N_blocks`

, `N_clusters_in_block`

, `N_i_in_cluster`

(when these are integers `N`

is the product of these three numbers).

Normal shocks can be specified at the individual, cluster, and block levels. If individual level shocks are not specified and cluster and block level variances sum to less than 1, then individual level shocks are set such that total variance in outcomes equals 1.

Key limitations: The designer assumes covariance between potential outcomes at the individual level only.

See vignette online.

A block cluster two-arm design.

1 2 3 4 5 6 7 | ```
# Generate a design using default arguments:
block_cluster_two_arm_design <- block_cluster_two_arm_designer()
block_cluster_uneven <- block_cluster_two_arm_designer(
N_blocks = 3, N_clusters_in_block = 2:4, N_i_in_cluster = 1:9)
# A design in which number of clusters of cluster size is not specified
# but N and block size are:
block_cluster_guess <- block_cluster_two_arm_designer(N = 24, N_blocks = 3)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.