pymare.results.MetaRegressionResults

class MetaRegressionResults(estimator, dataset, fe_params, fe_cov, tau2=None)[source]

Bases: object

Container for results generated by PyMARE meta-regression estimators.

Parameters:
  • estimator (BaseEstimator)) – The estimator used to produce the results.

  • dataset (Dataset)) – A Dataset instance containing the inputs to the estimator.

  • fe_params (numpy.ndarray of shape (p, d)) – Fixed-effect coefficients. Must be a 2-d numpy array with shape p x d, where p is the number of predictors, and d is the number of parallel datasets (typically 1).

  • fe_cov (numpy.ndarray of shape (p, p)) – The p x p inverse covariance (or precision) matrix for the fixed effects.

  • tau2 (None or numpy.ndarray of shape (d,) or float, optional) – A 1-d array containing the estimated tau^2 value for each parallel dataset (or a float, for a single dataset). May be omitted by fixed-effects estimators.

Warning

When an Estimator is fitted to arrays directly using the fit method, the Results object’s utility is limited. Many methods will not work.

property fe_se

Get fixed-effect standard error.

get_fe_stats(alpha=0.05)[source]

Get fixed-effect statistics.

Parameters:

alpha (float, optional) – Default = 0.05.

Returns:

A dictionary of fixed-effect statistics. The dictionary has the following keys:

est

The parameter estimate for the regressor.

se

The standard error of the estimate.

z

The z score of the estimate.

p

The p value the estimate.

ci_l/ci_u

Lower and upper bounds of the estimate.

Return type:

dict

get_heterogeneity_stats()[source]

Get heterogeneity statistics.

Warning

This method relies on the .dataset attribute, so the original Estimator must have be fitted with fit_dataset, not fit.

Returns:

A dictionary with the associated heterogeneity statistics. The keys to this dictionary are:

Q

Cochran’s Q [1]. This measure follows a chi-squared distribution, with n - k degrees of freedom, where n is the number of studies and k is the number of regressors.

p(Q)

P values associated with the Cochran’s Q values.

I^2

The proportion of the variance in study estimates that is due to heterogeneity instead of sampling error [2]. This measure is bounded from 0 to 100.

H

The ratio of the standard deviation of the estimated overall effect size from a random-effects meta-analysis compared to the standard deviation from a fixed-effect meta-analysis [2].

Return type:

dict

References

get_re_stats(method='QP', alpha=0.05)[source]

Get random-effect statistics.

Warning

This method relies on the .dataset attribute, so the original Estimator must have be fitted with fit_dataset, not fit.

Parameters:
  • method ({"QP"}, optional) – Method for estimating the confidence interval of the tau^2 estimate. Default = “QP” [3].

  • alpha (float, optional) – Default = 0.05.

Returns:

A dictionary of random-effect statistics. The dictionary has the following keys:

tau^2

The parameter estimate for the regressor.

ci_l/ci_u

Lower and upper bounds of the tau^2 estimate.

Return type:

dict

References

permutation_test(n_perm=1000)[source]

Run permutation test.

Warning

This method relies on the .dataset attribute, so the original Estimator must have be fitted with fit_dataset, not fit.

Parameters:

n_perm (int, optional) – Number of permutations to generate. The actual number used may be smaller in the event of an exact test (see below), but will never be larger. Default = 1000.

Returns:

An instance of class PermutationTestResults.

Return type:

PermutationTestResults

Notes

If the number of possible permutations is smaller than n_perm, an exact test will be conducted. Otherwise an approximate test will be conducted by randomly shuffling the outcomes n_perm times (or, for intercept-only models, by randomly flipping their signs). Note that for closed-form estimators (e.g., ‘DL’ and ‘HE’), permuted datasets are estimated in parallel. This means that one can often set very high n_perm values (e.g., 100k) with little performance degradation.

to_df(alpha=0.05)[source]

Return a pandas DataFrame summarizing fixed effect results.

Warning

This method only works for one-dimensional results.

Warning

This method relies on the .dataset attribute, so the original Estimator must have be fitted with fit_dataset, not fit.

Parameters:

alpha (float, optional) – Default = 0.05.

Returns:

df – DataFrame summarizing fixed effect results. The DataFrame will have one row for each regressor, and the following columns:

name

Name of the regressor.

estimate

The parameter estimate for the regressor.

se

The standard error of the estimate.

z-score

The z score of the estimate.

p-value

The p value the estimate.

ci_+

Lower and upper bounds of the estimate. There will be two columns, with names based on the alpha value. For example, if alpha = 0.05, the CI columns will be "ci_0.025" and "ci_0.975".

Return type:

pandas.DataFrame

Examples using pymare.results.MetaRegressionResults

The Basics of Running a Meta-Analysis

The Basics of Running a Meta-Analysis

Run Estimators on a simulated dataset

Run Estimators on a simulated dataset