pymare.estimators.SampleSizeBasedLikelihoodEstimator

class SampleSizeBasedLikelihoodEstimator(method='ml', **kwargs)[source]

Bases: BaseEstimator

Likelihood-based estimator for data with known sample sizes but unknown sampling variances.

Iteratively estimates the between-subject variance tau^2 and fixed effect betas using the specified likelihood-based estimator (ML or REML) [1].

Parameters:
  • method ({"ML", "REML"}, optional) – The estimation method to use. Either ‘ML’ (for maximum-likelihood) or ‘REML’ (restricted maximum-likelihood). Default = ‘ML’.

  • **kwargs – Keyword arguments to pass to the SciPy minimizer.

Notes

Homogeneity of sigma^2 across studies is assumed.

The ML and REML solutions are obtained via SciPy’s scalar function minimizer (scipy.optimize.minimize()). Parameters to minimize() can be passed in as keyword arguments.

References

fit(y, n, X)[source]

Fit the estimator to data.

Parameters:
Return type:

SampleSizeBasedLikelihoodEstimator

fit_dataset(dataset, *args, **kwargs)[source]

Apply the current estimator to the passed Dataset container.

A convenience interface that wraps fit() and automatically aligns the variables held in a Dataset with the required arguments.

Parameters:
  • dataset (Dataset) – A PyMARE Dataset instance holding the data.

  • *args – Optional positional arguments to pass onto the fit() method.

  • **kwargs – Optional keyword arguments to pass onto the fit() method.

get_v(dataset)[source]

Get the variances, or an estimate thereof, from the given Dataset.

Parameters:

dataset (Dataset) – The dataset to use to retrieve/estimate v.

Returns:

2-dimensional array of variances/variance estimates.

Return type:

numpy.ndarray

Notes

This is equivalent to directly accessing dataset.v when variances are present, but affords a way of estimating v from sample size (n) for any estimator that implicitly estimates a sigma^2 parameter.

summary()[source]

Generate a MetaRegressionResults object for the fitted estimator.

Return type:

MetaRegressionResults

Examples using pymare.estimators.SampleSizeBasedLikelihoodEstimator

Run Estimators on a simulated dataset

Run Estimators on a simulated dataset