Learn R Programming

whatifbandit (version 0.3.0)

check_impute: Checking Imputation Info

Description

Subsets or adds to the tibble/data.frame created by imputation_precompute(), and sorts it to ensure compatibility with randomizr::block_ra().

Usage

check_impute(imputation_information, current_data, current_period)

Arguments

imputation_information

The success element of the imputation_information list created by imputation_precompute() for the given period.

current_data

A tibble/data.table with only observations from the current sampling period.

current_period

Numeric value of length 1; current treatment wave of the simulation.

Details

randomizr::block_ra() does not see the names of the probabilities passed per block, so the imputation information must be subsetted to only contain blocks which are present in a period, and sorted to comply with randomizr::block_ra()'s internal ordering.

When blocks are required but do not exist in the information provided it is added to the tibble/data.table, with an estimated conditional probability of success as the average across other blocks.

When blocks are present but not required, they are removed from the tibble/data.table.