pymare.effectsize.OneSampleEffectSizeConverter

class OneSampleEffectSizeConverter(data=None, m=None, sd=None, n=None, r=None, **kwargs)[source]

Bases: EffectSizeConverter

Effect size converter for metric involving a single group/set of scores.

Parameters:
  • data (None or pandas.DataFrame, optional) – Optional pandas DataFrame to extract variables from. Column names must match the controlled names listed below for kwargs. If additional kwargs are provided, they will take precedence over the values in the data frame. Default = None.

  • m (None or numpy.ndarray, optional) – Means or other continuous estimates

  • sd (None or numpy.ndarray, optional) – Standard deviations

  • n (None or numpy.ndarray, optional) – Sample sizes

  • r (None or numpy.ndarray, optional) – Correlation coefficients

  • **kwargs – Optional keyword arguments providing additional inputs. All values must be floats, 1d ndarrays, or any iterable that can be converted to an ndarray. All variables must have the same length.

Notes

All input variables are assumed to reflect study- or analysis-level summaries, and are _not_ individual data points. E.g., do not pass in a vector of point estimates as m and a scalar for the SDs sd. The lengths of all inputs must match.

get(stat, error=True)[source]

Compute and return values for the specified statistic, if possible.

Parameters:
  • stat (str) – The name of the quantity to retrieve.

  • error (bool, optional) – Specifies behavior in the event that the requested quantity cannot be computed. If True (default), raises an exception. If False, returns None.

Returns:

A float or ndarray containing the requested parameter values, if successfully computed.

Return type:

float or numpy.ndarray

Notes

All values computed via get() are internally cached. Do not try to update the instance’s known values directly; any change to input data require either initialization of a new instance, or a call to update_data().

to_dataset(measure='RM', **kwargs)[source]

Get a Pymare Dataset with y and v mapped to the specified measure.

Parameters:
  • measure ({"RM", "SM", "D", "R", "ZR"}, optional) –

    The measure to map to the Dataset’s y and v attributes (where y is the desired measure, and v is its variance). Valid values include:

    • ’RM’: Raw mean of the group. This is the default.

    • ’SM’: Standardized mean. This is often called Hedges g.

      (one-sample), or equivalently, Cohen’s one-sample d with a bias correction applied.

    • ’D’: Cohen’s d. Note that no bias correction is applied

      (use ‘SM’ instead).

    • ’R’: Raw correlation coefficient.

    • ’ZR’: Fisher z-transformed correlation coefficient.

  • **kwargs – Optional keyword arguments to pass onto the Dataset initializer. Provides a way of supplementing the generated y and v arrays with additional arguments (e.g., X, X_names, n). See pymare.Dataset docs for details.

Return type:

Dataset

Notes

Measures ‘RM’, ‘SM’, and ‘D’ require m, sd, and n as inputs. Measures ‘R’ and ‘ZR’ require r and n as inputs.

update_data(incremental=False, **kwargs)[source]

Update instance data.

Parameters:
  • incremental (bool, optional) – If True, updates data incrementally (i.e., existing data will be preserved unless they’re overwritten by incoming keys). If False, all existing data is dropped first. Default = False.

  • **kwargs – Data values or arrays; keys are the names of the quantities. All inputs to __init__ are valid.