Skip to contents

Validates that power analysis results would have sufficient data after applying cost and power filters. Returns the original unfiltered data if validation passes.

Usage

check_power_results(
  power_df,
  cost_constraint,
  cost_precision,
  power_target,
  power_precision
)

Arguments

power_df

Data frame. Power analysis results with columns including overall_power, total_cost.

cost_constraint

Numeric. Maximum budget constraint in dollars. Set to NULL to disable cost filtering.

cost_precision

Numeric. Cost utilization factor. Filters designs with total cost \le cost_precision × cost_constraint.

power_target

Numeric. Target statistical power.

power_precision

Numeric. Acceptable precision around power target. Filters designs with power \ge power_target - power_precision.

Value

Data frame. The original unfiltered power analysis results (if validation passes).

Details

This function validates filtering viability without actually filtering:

  1. Cost check: Verifies that total_cost \le cost_precision × cost_constraint would leave at least one row (only when cost_constraint is not NULL)

  2. Power check: Verifies that overall_power \ge power_target - power_precision would leave at least one row

Throws informative errors when validation checks fail, otherwise returns the original data.