gemmr.sample_size.interpolation.calc_n_required
- gemmr.sample_size.interpolation.calc_n_required(metric, y_target_min, y_target_max, search_dim='n_per_ftr')
Calculate required sample sizes for a given metric.
Search is performed along dimension
search_dim
._calc_n_required()
performs a 1-dimensional interpolation using the logarithms of dimensionssearch_dim
as \(x\)-values and a slice ofmetric
along dimensionsearch_dim
as \(y\)-values to determine an estimation for the smallest value of dimensionsearch_dim
for which each slice of metric falls into and remains the range betweeny_target_min
andy_target_max
.- Parameters:
metric (xr.DataArray) – metric for which required sample size is computed. Must have dimension indicated in argument
search_dim
, and can have arbitrary other dimensionsy_target_min (float) – minimum acceptable metric value
y_target_max (float) – maximum acceptable metric value
search_dim (str) – dimension along which interpolation is performed to find required sample size
- Returns:
n_required – required sample sizes. Apart from dimension
search_dim
,DataArray
has same dimensions asmetric
- Return type:
xr.DataArray