# MCONF is the jSpectral module of jLab.

``` MCONF  Confidence intervals for the multitaper spectral estimate.

[RA,RB]=MCONF(K,GAMMA) returns the level GAMMA confidence interval
for the direct multitaper power spectral estimate of an average over K
eigenspectra.  RA and RB lower and upper ratios to the true value.

More specifically, if S0 is the true value of the spectrum, and if S is
the spectral estimate, then RA and RB satisfy

Probability that RA < S/S0 < RB = GAMMA

with RA and RB defined to be symmetrically placed around 1.

For example, GAMMA=0.95 computes the 95% confidence interval.

For the default settings of the multitaper spectrum implemented by
MSPEC, K is equal to 2P-1 where P is the time-bandwidth product.

The estimated confidence intervals can then be plotted as

plot(f,S),hold on,plot(f,S*ra),plot(f,S*rb)

where S is the spectral estimated computed by MSPEC, while is the
Fourier frequencies.

MCONF relies upon the fact that S/S0 is approximately distributed
as 1/(2K) times a chi-squared distribution with 2K degrees of freedom.
_____________________________________________________________________

Logarithmic confidence intervals

When plotting the logarithm of the spectrum, one should use a different
set of confidence intervals.

MCONF(K,GAMMA,'log10') returns the confidence intervals for the base-10
logarithm of the multitaper spectral estimate.  In this case, RA and RB
are defined such that

Probability that RA < LOG10(S)/LOG10(S0) < RB = GAMMA

and the confidence intervals can be plotted using either

plot(f,S),hold on,plot(f,10.^ra*S),plot(f,10.^rb*S)
set(gca,'yscale','log')

or else

plot(f,log10(S)),hold on,plot(f,ra+log10(S)),plot(f,rb+log10(S)).

MCONF(K,GAMMA,'natural') similarly returns the confidence intervals for
the natural logarithm of the multitaper spectral estimate.
_____________________________________________________________________