Determines whether sample sizes are approximately balanced across groups. Sample sizes are considered balanced when the smallest and largest group sizes are within the specified tolerance range relative to the average sample size.
Arguments
- data
A data frame or a list containing observations from each group.
- formula
A formula specifying the dependent variable (DV) and the independent variable (IV) in the form
DV ~ IV. This argument is required whendatais a data frame and is ignored whendatais already a list.- buffer_ratio
Numeric value between 0 and 1 (default: 0). The allowable proportional deviation from the mean sample size. For example,
buffer_ratio = 0.2allows group sizes to differ from the mean by up to 20%. Whenbuffer_ratio = 0, the function requires exact equality of sample sizes among groups.
Value
A logical value:
- TRUE
Sample sizes among groups are considered balanced.
- FALSE
At least one group has a sample size outside the specified tolerance range.
Details
The function compares each group's sample size with the mean sample size across groups. The sample sizes are considered balanced if:
$$ (1-r) \leq \frac{\min(n)}{\bar{n}} \leq \frac{\max(n)}{\bar{n}} \leq (1+r) $$
where \(\bar{n}\) is the mean sample size across groups and r is buffer_ratio.