First of all, I am new to these statistics stuff but very interested in the background. I try to understand the confidence interval calculation for a power spectral density estimate in MATLAB. For the estimation I use the pwelch function which uses Welch's Method. When a confidence level is specified, the function calls chi2conf(conf,k) where k is the number of independent measurements. In my case the number of independent measurements is the number of periodograms that are obtained by Welch's method. The different periodograms are averaged to get the power density spectrum.

The function chi2conf which is implemented in MATLAB's statistics toolbox does the following:

v    = 2*k;
alfa = 1 - conf;
c    = chi2inv([1-alfa/2 alfa/2], v);
c    = v./c;

chi2inv is the inverse chi squared function, v is the degree of freedom, $c=X^2$ and conf is the confidence level, for example 0.95.

My question is, why is there the factor 2 between k and v. Is this, because the periodograms are complex and therefore has two parameters?

The second question is, why do they not subtract one degree of freedom, as I saw here.

So MATLAB calculates

$$\frac{2k\cdot s^2}{X^2_{0.975}}\lt\sigma^2\lt\frac{2k\cdot s^2}{X^2_{0.025}}$$

and the theory says

$$\frac{(k-1)\cdot s^2}{X^2_{0.975}}\lt\sigma^2\lt\frac{(k-1)\cdot s^2}{X^2_{0.025}}$$

and the third, maybe correct option would be

$$\frac{(2k-1)\cdot s^2}{X^2_{0.975}}\lt\sigma^2\lt\frac{(2k-1)\cdot s^2}{X^2_{0.025}}$$

The sampling variance $s^2$ is here the power spectral density estimate itself, because it is obtained by calculating the auto-correlation which is closely related to the variance, if I understand correctly.

I hope, I am not too confusing. Thanks for your help!

  • $\begingroup$ Good question! No time for a full answer right now, but some pointers: Q1: Yes, its because the modulus squared of a complex variable where each component is normally distributed is a chi² with 2 degrees of freedom. Q2: Subtracting one degree of freedom applies to variance measurements, where variance is computed relative to the estimated mean. Note: The number of independent measurements is not necessarily identical to the number of averaged periodograms, because these are computed from overlapping data segments. $\endgroup$ – A. Donda Feb 12 '15 at 16:24
  • $\begingroup$ Thanks! Your note makes sense, but MATLAB does not consider this and takes the number of periodograms as number of independent measurements. I do not fully understand your answer to my second question. What does this mean for the PSD estimate? I am confused by "estimated mean". Do you mean that I have no estimated mean because the periodogram is calculated directly by auto-correlating the input signal? $\endgroup$ – Apollo3zehn Feb 13 '15 at 17:07
  • $\begingroup$ Ok, I checked and you're right, Matlab's pwelch takes the number of periodograms as the number of independent measurements. I think that's wrong, but maybe I'm missing something. – In estimating a variance, you compute the mean of square deviations from the mean. But this mean is not known beforehand, it has to be estimated from the data. This leads to a loss of one degree of freedom. In spectral estimation, one computes the mean square deviation from 0. 0 is not estimated, therefore no loss of df. $\endgroup$ – A. Donda Feb 15 '15 at 14:36
  • $\begingroup$ And now I ran a simulation and found that the confidence interval returned by pwelch contains the true value in less than 95% of cases (if that confidence was specified). The effect is not large, actual confidence lies at about 94.5%, but still this supports the notion that the computation of degrees of freedom is wrong. $\endgroup$ – A. Donda Feb 15 '15 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.