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 dimensions search_dim as \(x\)-values and a slice of metric along dimension search_dim as \(y\)-values to determine an estimation for the smallest value of dimension search_dim for which each slice of metric falls into and remains the range between y_target_min and y_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 dimensions

  • y_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 as metric

Return type:

xr.DataArray