NIPY logo

Site Navigation

NIPY Community

Table Of Contents

This Page

labs.group.spatial_relaxation_onesample

Module: labs.group.spatial_relaxation_onesample

Inheritance diagram for nipy.labs.group.spatial_relaxation_onesample:

Class

multivariate_stat

class nipy.labs.group.spatial_relaxation_onesample.multivariate_stat(data, vardata=None, XYZ=None, std=None, sigma=None, labels=None, network=None, v_shape=3, v_scale=20, std_shape=3, std_scale=20, m_mean_rate=0.001, m_var_shape=3, m_var_scale=20, disp_mask=None, labels_prior=None, label_values=None, labels_prior_mask=None)

Bases: object

Methods

compute_conditional_posterior_mean
compute_log_conditional_displacements_posterior
compute_log_conditional_posterior
compute_log_posterior
compute_log_prior
compute_log_region_likelihood
compute_log_region_likelihood_slow
compute_log_voxel_likelihood
compute_marginal_likelihood
estimate_displacements_SA
evaluate
init_hidden_variables
sample_log_conditional_posterior
update_block
update_block_SA
update_displacements
update_displacements_SA
update_effects
update_labels
update_mean_effect
update_parameters_mcmc
update_parameters_saem
update_summary_statistics
__init__(data, vardata=None, XYZ=None, std=None, sigma=None, labels=None, network=None, v_shape=3, v_scale=20, std_shape=3, std_scale=20, m_mean_rate=0.001, m_var_shape=3, m_var_scale=20, disp_mask=None, labels_prior=None, label_values=None, labels_prior_mask=None)

Multivariate modeling of fMRI group data accounting for spatial uncertainty In: data (n,p) estimated effects

vardata (n,p) variances of estimated effects XYZ (3,p) voxel coordinates std <float> Initial guess for standard deviate of spatial displacements sigma <float> regularity of displacement field labels (p,) labels defining regions of interest network (N,) binary region labels (1 for active, 0 for inactive) v_shape <float> intensity variance prior shape v_scale <float> intensity variance prior scale std_shape <float> spatial standard error prior shape std_scale <float> spatial standard error prior scale m_mean_rate <float> mean effect prior rate m_var_shape <float> effect variance prior shape m_var_scale <float> effect variance prior scale disp_mask (q,) mask of the brain, to limit displacements labels_prior (M,r) prior on voxelwise region membership labels_prior_values (M,r) voxelwise label values where prior is defined labels_prior_mask (r,) Mask of voxels where a label prior is defined
compute_conditional_posterior_mean(v=None, m_mean=None, m_var=None)

Compute posterior mean of mean effect map, conditional on parameters and displacements

compute_log_conditional_displacements_posterior(U=None, nsimu=100, burnin=100, proposal_std=None, verbose=False, change_U=False)

Compute posterior log density of elementary displacements at point U, conditional on model parameters

compute_log_conditional_posterior(v=None, m_mean=None, m_var=None, std=None)

compute log posterior density of model parameters, conditional on hidden parameters. This function is used in compute_log_region_posterior. It should only be used within the Gibbs sampler, and not the SAEM algorithm.

compute_log_posterior(v=None, m_mean=None, m_var=None, std=None, nsimu=100, burnin=100, stabilize=False, verbose=False, update_spatial=False)

compute log posterior density of region parameters by Rao-Blackwell method, or a stabilized upper bound if stabilize is True.

compute_log_prior(v=None, m_mean=None, m_var=None, std=None)

compute log prior density of model parameters, spatial uncertainty excepted, assuming hidden variables have been initialized

compute_log_region_likelihood(v=None, m_mean=None, m_var=None)
compute_log_region_likelihood_slow(v=None, m_mean=None, m_var=None, verbose=False, J=None)

Essentially maintained for debug purposes

compute_log_voxel_likelihood(v=None, m_mean=None, m_var=None, return_SS=False)
compute_marginal_likelihood(v=None, m_mean=None, m_var=None, std=None, nsimu=100, burnin=100, stabilize=False, verbose=False, update_spatial=False, U=None, proposal_std=None)
estimate_displacements_SA(nsimu=100, c=0.98999999999999999, proposal_std=None, verbose=False)

MAP estimate of elementary displacements conditional on model parameters

evaluate(nsimu=1000.0, burnin=100, J=None, verbose=False, proposal='prior', proposal_std=None, proposal_mean=None, compute_post_mean=False, mode='saem', update_spatial=True)

Sample posterior distribution of model parameters, or compute their MAP estimator In: nsimu <int> Number of samples drawn from posterior mean distribution

burnin <int> Number of discarded burn-in samples J (N,) voxel indices where successive mean values are stored verbose <bool> Print some infos during the sampling process proposal <str> ‘prior’, ‘rand_walk’ or ‘fixed’ proposal_mean <float> Used for fixed proposal only proposal_std <float> Used for random walk or fixed proposal mode <str> if mode=’saem’, compute MAP estimates of model parameters.

if mode=’mcmc’, sample their posterior distribution

update_spatial <bool> when False, enables sampling conditional on spatial parameters

Out: self.m_values (N, nsimu+burnin) successive mean values (if J is not empty) if self.labels_prior is not empty:

self.labels_post (M,r) posterior distribution of region labels
if self.std is not empty:
self.std_values (nsimu+burnin,) successive spatial standard deviate values
if compute_post_mean is True:
self.mean_m (p,) posterior average of mean effect self.var_m (p,) posterior variance of mean effect
if self.std is not empty and compute_post_mean is True:
self.r (n, nblocks) mean rejection rate for each displacement field self.mean_U (3, n, nblocks) posterior average of displacement weights self.var_U (3, n, nblocks) posterior marginal variances of displacement weights
init_hidden_variables(mode='saem', init_spatial=True)
sample_log_conditional_posterior(v=None, m_mean=None, m_var=None, std=None, nsimu=100, burnin=100, stabilize=False, verbose=False, update_spatial=False)

sample log conditional posterior density of region parameters using a Gibbs sampler (assuming all hidden variables have been initialized). Computes posterior mean. if stabilize is True, sampling is conditioned on the parameters, reducing the variance of the estimate, but introducing a positive bias.

update_block(i, b, proposal='prior', proposal_std=None, proposal_mean=None, verbose=False, reject_override=False)
update_block_SA(i, b, T=1.0, proposal_std=None, verbose=False, reject_override=False, proposal='rand_walk', proposal_mean=None)

Update displacement block using simulated annealing scheme with random-walk kernel

update_displacements()
update_displacements_SA(T=1.0, proposal_std=None, verbose=False)
update_effects(T=1.0)

T is a temperature used to compute log posterior density by simulated annealing

update_labels()
update_mean_effect(T=1.0)

T is a temperature used to compute log posterior density by simulated annealing

update_parameters_mcmc(update_spatial=True)
update_parameters_saem(update_spatial=True)
update_summary_statistics(w=1.0, update_spatial=True, mode='saem')

Functions

nipy.labs.group.spatial_relaxation_onesample.log_gammainv_pdf(x, a, b)

log density of the inverse gamma distribution with shape a and scale b, at point x, using Stirling’s approximation for a > 100

nipy.labs.group.spatial_relaxation_onesample.log_gaussian_pdf(x, m, v)

log density of the gaussian distribution with mean m and variance v at point x