Declare Estimand

declare_estimand(..., handler = estimand_handler, label = "my_estimand")



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.


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


my_population <- declare_population(N = 100) my_potential_outcomes <- declare_potential_outcomes( formula = Y ~ .25 * Z, conditions = 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, label) { ret <- with(data, median(Y_Z_1 - Y_Z_0)) data.frame(setNames(ret, label)) } my_estimand_custom <- declare_estimand( handler = my_estimand_function, label = "medianTE") my_estimand_custom(df)
#> setNames.ret..label. #> medianTE 0.25