Fork me on GitHub

pyhrf.stats.misc module

pyhrf.stats.misc.acorr(x, maxlags=10, scale='var')
pyhrf.stats.misc.compute_T_Pvalue(betas, stds_beta, mask_file, null_hyp=True)

Compute Tvalues statistic and Pvalue based upon estimates and their standard deviation beta and std_beta for all voxels beta: shape (nb_vox, 1) std: shape (1) Assume null hypothesis if null_hyp is True

pyhrf.stats.misc.compute_roc_labels(mlabels, true_labels, dthres=0.005, lab_ca=1, lab_ci=0, false_pos=2, false_neg=3)
pyhrf.stats.misc.compute_roc_labels_scikit(e_labels, true_labels)
pyhrf.stats.misc.cpt_ppm_a_apost(means, variances, props, alpha=0.05)
pyhrf.stats.misc.cpt_ppm_a_mcmc(samples, alpha=0.05)

Compute a Posterior Probability Map (fixed alpha) from NRL MCMC samples. Expected shape of ‘samples’: (sample, voxel)

pyhrf.stats.misc.cpt_ppm_a_norm(mean, variance, alpha=0.0)

Compute a Posterior Probability Map (fixed alpha) by assuming a Gaussian distribution.

Parameters:
  • mean (array_like) – mean value(s) of the Gaussian distribution(s)
  • variance (array_like) – variance(s) of the Gaussian distribution(s)
  • alpha (array_like, optional) – quantile value(s) (default=0)
Returns:

ppm – Posterior Probability Map evaluated at alpha

Return type:

array_like

pyhrf.stats.misc.cpt_ppm_g_apost(means, variances, props, gamma=0.0)

Compute a Posterior Probability Map (fixed gamma) from posterior gaussian mixture components estimates. Expected shape of ‘means’, ‘variances’ and ‘probs’: (nb_classes, voxel)

pyhrf.stats.misc.cpt_ppm_g_mcmc(samples, gamma=0.0)

Compute a Posterior Probability Map (fixed gamma) from NRL MCMC samples. Expected shape of ‘samples’: (sample, voxel)

pyhrf.stats.misc.cpt_ppm_g_norm(mean, variance, gamma=0.95)

Compute a Posterior Probability Map (fixed gamma) by assuming a Gaussian distribution.

Parameters:
  • mean (array_like) – mean value(s) of the Gaussian distribution(s)
  • variance (array_like) – variance(s) of the Gaussian distribution(s)
  • gamma (array_like, optional) – upper tail probability (default=0.95)
Returns:

ppm – Posterior Probability Map corresponding to the upper tail probability gamma

Return type:

ndarray or scalar

pyhrf.stats.misc.cumFreq(data, thres=None)
pyhrf.stats.misc.gm_cdf(x, means, variances, props)

Compute the cumulative density function of gaussian mixture, ie: p(x<a) = sum_i Nc(mean_i, variance_i)

pyhrf.stats.misc.gm_mean(means, variances, props)
pyhrf.stats.misc.gm_var(means, variances, props)
pyhrf.stats.misc.mark_wrong_labels(labels, true_labels, lab_ca=1, lab_ci=0, false_pos=2, false_neg=3)
pyhrf.stats.misc.threshold_labels(labels, thresh=None, act_class=1)

Threshold input labels which are assumed being of shape (nb classes, nb conds, nb vox). If thresh is None then take the argmax over classes. Else use it on labels for activating class (act_class), suitable for the 2class case only.