gemmr.sample_analysis.analyzers.analyze_model

gemmr.sample_analysis.analyzers.analyze_model(estr, Sigma, px, ns, x_align_ref=None, y_align_ref=None, addons=(), n_rep=10, n_perm=100, random_state=None, **kwargs)

Synthetic datasets drawn from a model are analyzed with a given stimator.

The model is specified by the covariance matrix Sigma. Synthetic datasets are drawn from the corresponding normal distribution and analyzed.

Parameters:
  • estr (sklearn-style estimator) – for performing CCA or PLS. Must have method fit and (after fitting) attributes assocs_, x_rotations_, y_rotations_, x_scores_, y_scores_
  • Sigma ((total number of features in X and Y, total number of features) – in X and Y) model covariance matrix
  • px (int) – number of X features (number of Y features is inferred from size of Sigma)
  • ns (list-like of int) – datasets of these sizes are generated from the model and analyzed
  • x_align_ref ((n_features,)) – after fitting, the sign of X weights is chosen such that the cosine-distance between fitted X weights and x_align_ref is positive
  • y_align_ref ((n_features,)) – after fitting, the sign of Y weights is chosen such that the cosine-distance between fitted Y weights and y_align_ref is positive
  • addons (list-like of add-on functions) –

    After fitting the estimator and saving association strengths, weights and loadings in results additional analyses can be performed with these functions. They are called in the given order, and must have the signature

    addana_fun(estr, X, Y, Xorig, Yorig, x_align_ref, y_align_ref,
        results, **kwargs)
    

    and are expected to save their respective outcome features results. Various such functions are provided in module sample_analysis_addons

  • n_rep (int) – number of times a dataset of a given size is generated
  • n_perm (int) – each generated dataset is permuted n_perm times to generate a null-distribution of outcome quantities
  • random_state (None, int or random number generator instance) – used to generate random numbers
  • kwargs (dict) – forwarded to additional analysis functions
Returns:

results – containing data variables for outcome features generated by analyses

Return type:

xr.Dataset