Generate a randomized control treatment Design
(`rct_design()`

), or an observational Design (`obs_design()`

), or a
regression discontinuity Design (`rd_design()`

).

## Usage

```
rct_design(formula, data, subset = NULL, na.fail = TRUE)
rd_design(formula, data, subset = NULL, na.fail = TRUE)
obs_design(formula, data, subset = NULL, na.fail = TRUE)
```

## Arguments

- formula
a

`formula`

defining the`Design`

components. See`Details`

for specification.- data
the data set from which to build the Design. Note that this data need not be the same as used to estimate the treatment effect; rather the

`data`

passed should contain information about the units of treatment assignment (as opposed to the units of analysis).- subset
optional, subset the data before creating the

`Design`

object- na.fail
If

`TRUE`

(default), any missing data found in the variables specified in`formula`

(excluding treatment) will trigger an error. If`FALSE`

, non-complete cases will be dropped before the creation of the`Design`

## Details

The formula must include exactly one `unit_of_assignment()`

to
identify the units of assignment (one or more variables). (`uoa`

,
`cluster`

, or `unitid`

are synonyms for
`unit_of_assignment`

; the choice of which has no impact on the
analysis.) If defining an `rd_design`

, the formula must also include
a `forcing()`

entry. The formula may optionally include a `block()`

as
well. Each of these can take in multiple variables, e.g. to pass both a
household ID and individual ID as unit of assignment, use ```
uoa(hhid,
iid)
```

and not `uoa(hhid) + uoa(iid)`

.

The treatment variable passed into the left-hand side of `formula`

can either be `logical`

, `numeric`

, or `character`

. If it
is anything else, it attempts conversion to one of those types (for
example, `factor`

and `ordered`

are converted to `numeric`

if the levels are `numeric`

, otherwise to `character`

). If the
treatment is not `logical`

or `numeric`

with only values 0 and
1, in order to generate weights with `ate()`

or `ett()`

, the
`dichotomy`

argument must be used in those functions to identify the
treatment and control groups. See `ett()`

for more details on specifying a
`dichotomy`

.

## Examples

```
data(simdata)
des <- rct_design(z ~ unit_of_assignment(uoa1, uoa2) + block(bid),
data = simdata)
data(schooldata)
des <- obs_design(treatment ~ unit_of_assignment(schoolid) + block(state),
data = schooldata)
```