power1d.prob¶
Theoretical continuum-level probabilities for central t fields and for noncentral t and F fields.
These calculations come from the random field theory (RFT) literature and in particular from the three references listed below. The main RFT calculations come from Hasofer (1978) and Friston et al. (1994). Non-central RFT power analysis follows Hayasaka et al. (2007) and Joyce & Hayasaka (2012). The non-central Euler characteristic densities are implemented from the expected upcrossings formula (Rice 1945).
REFERENCES
ec_density_f¶
- power1d.prob.ec_density_f(z, v, delta=None)¶
Euler characteristic density for central F fields.
Adapted from “spm_ECdensity.m” in “SPM12” (Friston et al. 1994)
Arguments:
z —- height (float)
v —- degrees of freedom (float, float)
delta —- (not used by this function)
Reference: Worsley KJ et al. (1996) Hum Brain Mapp 4:58-73 Reference: Worsley KJ et al. (2004) [Eqn.2 and Table 2]
ec_density_ncf¶
- power1d.prob.ec_density_ncf(z, v, delta)¶
Euler characteristic density for non-central F fields.
The field is F = (U/v0) / (V/v1) where U is a non-central chi-square field (v0 degrees of freedom, non-centrality delta) and V is a chi-square field (v1 degrees of freedom). Given V=s and F=z the field derivative is Gaussian with variance (v1/v0)**2 * 4*lambda*c*(1+c)/s where c = v0*z/v1 and lambda = 4*log(2) is the variance of the unit-FWHM Gaussian field derivative. The expected upcrossings formula then gives
ec1 = sqrt( 2*lambda*c*(1+c) / pi ) * I
where I is the integral over s of sqrt(s) * p_V(s) * p_U(c*s).
Arguments:
z —- height (float)
v —- degrees of freedom (float, float)
delta —- non-centrality parameter (float)
ec_density_nct¶
- power1d.prob.ec_density_nct(z, v, delta)¶
Euler characteristic density for non-central t fields.
The field is T = (Z + delta) / sqrt(S/v) where Z is a Gaussian field and S is a chi-square field (v degrees of freedom). Given S=s and T=z the field derivative is Gaussian with variance lambda*(v + z**2)/s where lambda = 4*log(2) is the variance of the unit-FWHM Gaussian field derivative. The expected upcrossings formula then gives
ec1 = sqrt( lambda*(1 + z**2/v) / (2*pi) ) * I
where I is the integral over s of p_S(s) * phi( z*sqrt(s/v) - delta ) and phi is the standard normal density.
Arguments:
z —- height (float)
v —- degrees of freedom (float)
delta —- non-centrality parameter (float)
ec_density_t¶
- power1d.prob.ec_density_t(z, v, delta=None)¶
Euler characteristic density for central t fields.
Adapted from “spm_ECdensity.m” in “SPM12” (Friston et al. 1994)
Arguments:
z —- height (float)
v —- degrees of freedom (float)
delta —- (not used by this function)
Reference: Worsley KJ et al. (1996) Hum Brain Mapp 4:58-73 Reference: Worsley KJ et al. (2004) [Eqn.2 and Table 2]
exp_ncx¶
- power1d.prob.exp_ncx(df, delta, r)¶
Non-central chi-square moments around zero
E[X**r] = 2**r * exp(-delta/2) * G(r + df/2) / G(df/2) * 1F1(r + df/2, df/2, delta/2)
where G is the gamma function and 1F1 is the confluent hypergeometric function.
Arguments:
df —- degrees of freedom (float)
delta —- non-centrality parameter (float)
r —- power (float greater than -df/2)
f_isf¶
- power1d.prob.f_isf(alpha, df, Q, fwhm)¶
Inverse survival function for central f fields
Arguments:
alpha —- Type I error rate (float between 0 and 1)
df —- degrees of freedom (float, float)
Q —- continuum size (integer)
fwhm —- continuum smoothness (positive float); full-width-at-half-maximum
f_sf¶
- power1d.prob.f_sf(u, df, Q, fwhm)¶
Survival function for central F fields.
Arguments:
u —- height (float)
df —- degrees of freedom (float)
Q —- continuum size (integer)
fwhm —- continuum smoothness (positive float); full-width-at-half-maximum
ncf_sf¶
- power1d.prob.ncf_sf(u, df, Q, fwhm, delta)¶
Survival function for noncentral f fields.
Arguments:
u —- height (float)
df —- degrees of freedom (float)
Q —- continuum size (integer)
fwhm —- continuum smoothness (positive float); full-width-at-half-maximum
delta —- noncentrality parameter
nct_sf¶
- power1d.prob.nct_sf(u, df, Q, fwhm, delta)¶
Survival function for noncentral t fields.
Arguments:
u —- height (float)
df —- degrees of freedom (float)
Q —- continuum size (integer)
fwhm —- continuum smoothness (positive float); full-width-at-half-maximum
delta —- noncentrality parameter
t_isf¶
- power1d.prob.t_isf(alpha, df, Q, fwhm)¶
Inverse survival function for central t fields
Arguments:
alpha —- Type I error rate (float between 0 and 1)
df —- degrees of freedom (float)
Q —- continuum size (integer)
fwhm —- continuum smoothness (positive float); full-width-at-half-maximum
t_sf¶
- power1d.prob.t_sf(u, df, Q, fwhm)¶
Survival function for central t fields.
Arguments:
u —- height (float)
df —- degrees of freedom (float)
Q —- continuum size (integer)
fwhm —- continuum smoothness (positive float); full-width-at-half-maximum
power_Friston1994¶
- power1d.prob.power_Friston1994(alpha, df, Q, W0, W1, sigma)¶
Continuum-level power calculation using the inflated variance method (Friston et al. 1994)
Arguments:
alpha —— Type I error rate (float)
df —— degrees of freedom (float)
Q —— continuum size (int)
W0 —— continuum smoothness under the null hypothesis (positive float)
W1 —— continuum smoothness under the alternative hypothesis (float)
sigma —— effect size (noise amplitude under the alternative hypothesis) (positive float)
Reference:
Friston KJ, Worsley KJ, Frackowiak RSJ, Mazziotta JC, Evans AC (1994). Assessing the significance of focal activations using their spatial extent. Human Brain Mapp 1: 210-220.
power_Hayasaka2007¶
- power1d.prob.power_Hayasaka2007(alpha, df, Q, fwhm, effect)¶
Continuum-level power calculation using the non-central t method (Hayasaka et al. 2007)
Arguments:
alpha —— Type I error rate (float)
df —— degrees of freedom (float)
Q —— continuum size (int)
fwhm —— continuum smoothness (positive float)
effect —— effect size (random field shift as: mu/sigma) (float)
Reference:
Hayasaka S, Peiffer AM, Hugenschmidt CE, Laurienti PJ (2007). Power and sample size calculation for neuroimaging studies by non-central random field theory. NeuroImage 37(3), 721-730.
power¶
- power1d.prob.power(alpha, df, Q, fwhm, effect, method='nct')¶
Continuum-level theoretical power calculations for one-sample t tests.
This is a convenience function for generating comparable results for the “iv” and “nct” methods (see below). That is, the two methods define effects slightly differently, but this function ensures that the effect is defined approximately the same for both methods, thus making the two methods directly comparable.
alpha —— Type I error rate (float)
df —— degrees of freedom (float)
Q —— continuum size (int)
fwhm —— continuum smoothness (positive float)
effect —— effect size (float)
method —— one of “iv” or “nct”
Methods:
iv —— inflated variance method (Friston et al. 1994)
nct —— noncentral t method (Hayasaka et al. 2007)