pymare.core.meta_regression

meta_regression(y=None, v=None, X=None, n=None, data=None, X_names=None, add_intercept=True, method='ML', ci_method='QP', alpha=0.05, **kwargs)[source]

Fit the standard meta-regression/meta-analysis model to provided data.

Parameters
  • y (None or numpy.ndarray of shape (K,) or str, optional) – 1d array of study-level estimates with length K, or the name of the column in data containing the y values. Default = None.

  • v (None or numpy.ndarray of shape (K,) or str, optional) – 1d array of study-level variances with length K, or the name of the column in data containing v values. Default = None.

  • X (None or numpy.ndarray of shape (K,[P]) or list of str, optional) – 1d or 2d array containing study-level predictors (dimensions K x P), or a list of strings giving the names of the columns in data containing the X values. Default = None.

  • n (None or numpy.ndarray of shape (K,) or str, optional) – 1d array of study-level sample sizes (length K), or the name of the corresponding column in data. Default = None.

  • data (None or pandas.DataFrame or Dataset, optional) – If a Dataset instance is passed, the y, v, X, n and associated arguments are ignored, and data is passed directly to the selected estimator. If a pandas DataFrame, y, v, X and/or n values are taken from the DF columns. By default, columns are expected to have the same names as arguments (e.g., the y values will be expected in the ‘y’ column). This can be modified by passing strings giving column names to any of the y, v, X, or n arguments.

  • X_names (None or list of str, optional) – List of length P containing the names of the predictors. Ignored if data is provided (use X to specify columns). Default = None.

  • add_intercept (bool, optional) – If True, an intercept column is automatically added to the predictor matrix. If False, the predictors matrix is passed as-is to estimators. Default = True.

  • method ({"ML", "REML", "DL", "HE", "WLS", "FE", "Stan"}, optional) –

    Name of estimation method. Default = ‘ML’. Supported estimators include:

    • ’ML’: Maximum-likelihood estimator

    • ’REML’: Restricted maximum-likelihood estimator

    • ’DL’: DerSimonian-Laird estimator

    • ’HE’: Hedges estimator

    • ’WLS’ or ‘FE’: Weighted least squares (fixed effects only)

    • ’Stan’: Full Bayesian MCMC estimation via Stan

  • ci_method ({"QP"}, optional) – Estimation method to use when computing uncertainty estimates. Currently only ‘QP’ is supported. Default = ‘QP’. Ignored if method == 'Stan'.

  • alpha (float, optional) – Desired alpha level (CIs will have 1 - alpha coverage). Default = 0.05.

  • **kwargs – Optional keyword arguments to pass onto the chosen estimator.

Returns

A MetaRegressionResults or BayesianMetaRegressionResults instance, depending on the specified method (‘Stan’ will return the latter; all other methods return the former).

Return type

MetaRegressionResults or BayesianMetaRegressionResults