Declare Estimand

declare_estimand(..., estimand_function = estimand_function_default,
label = NULL)

## Arguments

... Arguments to the estimand function. For example, you might specify ATE = mean(Y_Z_1 - Y_Z_0), which would declare the estimand to be named ATE and to be the mean of the difference in the control and treatment potential outcome. A function that takes a data.frame as an argument and returns a data.frame with the estimand and a label. By default, the estimand function accepts an expression such as ATE = mean(Y_Z_1-Y_Z_0). An optional label to name the estimand, such as ATE. Typically, the label is inferred from how you specify the estimand in ..., i.e. if you specify ATE = mean(Y_Z_1 - Y_Z_0) the estimand label will be ATE.

## Value

a function that accepts a data.frame as an argument and returns a data.frame containing the value of the estimand.

## Examples


my_population <- declare_population(N = 100)

my_potential_outcomes <- declare_potential_outcomes(
formula = Y ~ .25 * Z,
condition_names = c(0, 1))

df <- my_potential_outcomes(my_population())

# Use the default estimand setup to
# declare an average treatment effect estimand

my_estimand <- declare_estimand(ATE = mean(Y_Z_1 - Y_Z_0))

my_estimand(df)#>   estimand_label estimand
#> 1            ATE     0.25
# Custom random assignment functions

my_estimand_function <- function(data) {
with(data, median(Y_Z_1 - Y_Z_0))
}
my_estimand_custom <- declare_estimand(
estimand_function = my_estimand_function, label = medianTE)

my_estimand_custom(df)#>   estimand_label estimand
#> 1       medianTE     0.25