Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Multivariate parametric spectral estimation with and without fft.m

Subject: Multivariate parametric spectral estimation with and without fft.m

From: Martin Uebele

Date: 6 Apr, 2005 04:09:28

Message: 1 of 8

Hi,

I calculated the spectrum from AR-coefficients one time with the help
of the fft-function and the other time by using a for-loop and
multiplying the coefficients by exp(-i*w*k). I understand that this
should be the same, but my results don't confirm this. Can anyone
explain that?

I need the program (especially the multivariate extension of it),
because I want to calculate coherency of two time series, but the
nonparametric estimators need too much data, so I need a parametric
one, but it is not implemented anywhere.

%B_hat: vector of AR-coefficients
%lags: order of AR-model
%w: frequency

NFFT=2^8;
freq=0;
for w=pi/NFFT:pi/NFFT:pi
    freq=freq+1;
    H_ar=1;
    for k=1:lags
        H_ar=H_ar+B_hat(k)*exp(-sqrt(-1)*k*w);
    end
    inv_har=inv(H_ar);
    power(freq,:)=abs(inv_har).^2;
end
plot(power)

Subject: Multivariate parametric spectral estimation with and without fft.m

From: Rune Allnor

Date: 9 Apr, 2005 02:37:23

Message: 2 of 8


Martin Uebele wrote:
> Hi,
>
> I calculated the spectrum from AR-coefficients one time with the help
> of the fft-function and the other time by using a for-loop and
> multiplying the coefficients by exp(-i*w*k). I understand that this
> should be the same, but my results don't confirm this. Can anyone
> explain that?
>
> I need the program (especially the multivariate extension of it),
> because I want to calculate coherency of two time series, but the
> nonparametric estimators need too much data, so I need a parametric
> one, but it is not implemented anywhere.

If you need to compute the coherence between data series,
consult

Bendat & Piersol: "Random Data", 3rd ed.,
     Wiley, 2000.

Don't expect parametric models to be of much help. Coherence
computations include phase information, which is lost in AR models.

If matlab's for-loops take too long, consider implementing the
computations as MEX files.

Rune

Subject: Multivariate parametric spectral estimation with and without fft.m

From: Alois Schloegl

Date: 9 Apr, 2005 18:03:52

Message: 3 of 8



You might want to look at the TSA-toolbox
http://www.dpmi.tu-graz.ac.at/~schloegl/matlab/tsa/


see MVAR, MVFREQZ


 - A.


On Wed, 06 Apr 2005 04:09:28 -0400, Martin Uebele wrote:

> Hi,
>
> I calculated the spectrum from AR-coefficients one time with the help
> of the fft-function and the other time by using a for-loop and
> multiplying the coefficients by exp(-i*w*k). I understand that this
> should be the same, but my results don't confirm this. Can anyone
> explain that?
>
> I need the program (especially the multivariate extension of it),
> because I want to calculate coherency of two time series, but the
> nonparametric estimators need too much data, so I need a parametric
> one, but it is not implemented anywhere.
>
> %B_hat: vector of AR-coefficients
> %lags: order of AR-model
> %w: frequency
>
> NFFT=2^8;
> freq=0;
> for w=pi/NFFT:pi/NFFT:pi
> freq=freq+1;
> H_ar=1;
> for k=1:lags
> H_ar=H_ar+B_hat(k)*exp(-sqrt(-1)*k*w);
> end
> inv_har=inv(H_ar);
> power(freq,:)=abs(inv_har).^2;
> end
> plot(power)

Subject: Multivariate parametric spectral estimation wi

From: Martin Uebele

Date: 23 Apr, 2005 04:38:37

Message: 4 of 8

Rune, thanks for your answer! However, I'm very confused, because I'm
trying to use the same procedure as in the paper

A'Hearn, Brian and Ulrich Woitek (2001): More international evidence
on business cycles, Journal of Monetary Economics, 47, 321-346,

where they calculate explained variance in the frequency domain from
squared coherency, and get the spectrum matrix from coefficients of a
multivariate autoregression.

Do you really mean that's not possible? With my short time series
nonparametric analysis does not make sense I understand.

Martin

Rune Allnor wrote:
>
>
>
> Martin Uebele wrote:
>> Hi,
>>
>> I calculated the spectrum from AR-coefficients one time with
the
> help
>> of the fft-function and the other time by using a for-loop and
>> multiplying the coefficients by exp(-i*w*k). I understand that
> this
>> should be the same, but my results don't confirm this. Can
anyone
>> explain that?
>>
>> I need the program (especially the multivariate extension of
it),
>> because I want to calculate coherency of two time series, but
the
>> nonparametric estimators need too much data, so I need a
> parametric
>> one, but it is not implemented anywhere.
>
> If you need to compute the coherence between data series,
> consult
>
> Bendat & Piersol: "Random Data", 3rd ed.,
> Wiley, 2000.
>
> Don't expect parametric models to be of much help. Coherence
> computations include phase information, which is lost in AR models.
>
> If matlab's for-loops take too long, consider implementing the
> computations as MEX files.
>
> Rune
>
>

Subject: Multivariate parametric spectral estimation wi

From: Martin Uebele

Date: 23 Apr, 2005 04:44:17

Message: 5 of 8

Thanks a lot for that toolbox!

It almost works, but unfortunately I can't use the covariance matrix
C, since it's just some elements from PE from MVAR.M, but the
dimenions don't fit for all M and P if C=PE(:,M*P+1:(M+1)*P) is
applied.

Martin

Alois Schloegl wrote:
>
>
>
>
> You might want to look at the TSA-toolbox
> <http://www.dpmi.tu-graz.ac.at/~schloegl/matlab/tsa/>
>
>
> see MVAR, MVFREQZ
>
>
> - A.
>
>
> On Wed, 06 Apr 2005 04:09:28 -0400, Martin Uebele wrote:
>
>> Hi,
>>
>> I calculated the spectrum from AR-coefficients one time with
the
> help
>> of the fft-function and the other time by using a for-loop and
>> multiplying the coefficients by exp(-i*w*k). I understand that
> this
>> should be the same, but my results don't confirm this. Can
anyone
>> explain that?
>>
>> I need the program (especially the multivariate extension of
it),
>> because I want to calculate coherency of two time series, but
the
>> nonparametric estimators need too much data, so I need a
> parametric
>> one, but it is not implemented anywhere.
>>
>> %B_hat: vector of AR-coefficients
>> %lags: order of AR-model
>> %w: frequency
>>
>> NFFT=2^8;
>> freq=0;
>> for w=pi/NFFT:pi/NFFT:pi
>> freq=freq+1;
>> H_ar=1;
>> for k=1:lags
>> H_ar=H_ar+B_hat(k)*exp(-sqrt(-1)*k*w);
>> end
>> inv_har=inv(H_ar);
>> power(freq,:)=abs(inv_har).^2;
>> end
>> plot(power)
>
>

Subject: Multivariate parametric spectral estimation wi

From: Rune Allnor

Date: 24 Apr, 2005 21:51:00

Message: 6 of 8


Martin Uebele wrote:
> Rune, thanks for your answer! However, I'm very confused, because I'm
> trying to use the same procedure as in the paper
>
> A'Hearn, Brian and Ulrich Woitek (2001): More international evidence
> on business cycles, Journal of Monetary Economics, 47, 321-346,
>
> where they calculate explained variance in the frequency domain from
> squared coherency, and get the spectrum matrix from coefficients of a
> multivariate autoregression.

Did they use the method you tried? Did they use regression models
based on sums-of-sines, or more standard AR/ARMA methods?
Did they estimate amplitude spectra from the data, or only
spectral shapes?

> Do you really mean that's not possible? With my short time series
> nonparametric analysis does not make sense I understand.

I wouldn't state it quite as pointed as that. I would be very,
very careful, though, before I accept the results from an
analysis based on parametric methods in general, and sum-of-sine
methods in particular. It would take a great deal of persuation
before I accepted the claims:

- I would require a theoretical study of the method, which
  results would clearly and consistently refute my rather
  naively stated (but not irrelevant!) first objections
- I would require simulation studies, including bad signal
  models and added noise, that support the theoretical
  results that as of yet have not been presented
- I would require all the preparations above to be reproduced
  and confirmed by independent analysts
- I would not use the method until I understood the theory
  myself and had conducted my own simulation studies to
  see that the claims hold, and how the methods break
  down with poor models and added noise

And even if all the above should check out some day, I would be
very, very careful with what I do and how I use the method,
regardless of whether it's based on the sum-of-sines or some
AR/ARMA type of model.

Rune

> Rune Allnor wrote:
> >
> >
> >
> > Martin Uebele wrote:
> >> Hi,
> >>
> >> I calculated the spectrum from AR-coefficients one time with
> the
> > help
> >> of the fft-function and the other time by using a for-loop and
> >> multiplying the coefficients by exp(-i*w*k). I understand that
> > this
> >> should be the same, but my results don't confirm this. Can
> anyone
> >> explain that?
> >>
> >> I need the program (especially the multivariate extension of
> it),
> >> because I want to calculate coherency of two time series, but
> the
> >> nonparametric estimators need too much data, so I need a
> > parametric
> >> one, but it is not implemented anywhere.
> >
> > If you need to compute the coherence between data series,
> > consult
> >
> > Bendat & Piersol: "Random Data", 3rd ed.,
> > Wiley, 2000.
> >
> > Don't expect parametric models to be of much help. Coherence
> > computations include phase information, which is lost in AR models.
> >
> > If matlab's for-loops take too long, consider implementing the
> > computations as MEX files.
> >
> > Rune
> >
> >

Subject: Multivariate parametric spectral estimation wi

From: Martin Uebele

Date: 25 Apr, 2005 03:37:45

Message: 7 of 8

A'Hearn/Woitek use an AR-model and calculate the coefficients by
least squares. I use A. Schloegl's tsa-toolbox and calculate the
coefficients by the Nutall-Strand method. The same toolbox also
calculates coherency from AR/ARMA-parameters. When I simulate two
sine waves with known frequencies my programme yields lower explained
frequency the greater the difference is between the frequencies.

I will discuss your objections with the authors of the mentioned
paper, who I have some contact with. Thanks for giving me that
advise!

Rune Allnor wrote:
>
>
>
> Martin Uebele wrote:
>> Rune, thanks for your answer! However, I'm very confused,
because
> I'm
>> trying to use the same procedure as in the paper
>>
>> A'Hearn, Brian and Ulrich Woitek (2001): More international
> evidence
>> on business cycles, Journal of Monetary Economics, 47, 321-346,
>>
>> where they calculate explained variance in the frequency domain
> from
>> squared coherency, and get the spectrum matrix from
coefficients
> of a
>> multivariate autoregression.
>
> Did they use the method you tried? Did they use regression models
> based on sums-of-sines, or more standard AR/ARMA methods?
> Did they estimate amplitude spectra from the data, or only
> spectral shapes?
>
>> Do you really mean that's not possible? With my short time
series
>> nonparametric analysis does not make sense I understand.
>
> I wouldn't state it quite as pointed as that. I would be very,
> very careful, though, before I accept the results from an
> analysis based on parametric methods in general, and sum-of-sine
> methods in particular. It would take a great deal of persuation
> before I accepted the claims:
>
> - I would require a theoretical study of the method, which
> results would clearly and consistently refute my rather
> naively stated (but not irrelevant!) first objections
> - I would require simulation studies, including bad signal
> models and added noise, that support the theoretical
> results that as of yet have not been presented
> - I would require all the preparations above to be reproduced
> and confirmed by independent analysts
> - I would not use the method until I understood the theory
> myself and had conducted my own simulation studies to
> see that the claims hold, and how the methods break
> down with poor models and added noise
>
> And even if all the above should check out some day, I would be
> very, very careful with what I do and how I use the method,
> regardless of whether it's based on the sum-of-sines or some
> AR/ARMA type of model.
>
> Rune
>
>> Rune Allnor wrote:
>> >
>> >
>> >
>> > Martin Uebele wrote:
>> >> Hi,
>> >>
>> >> I calculated the spectrum from AR-coefficients one
time with
>> the
>> > help
>> >> of the fft-function and the other time by using a
for-loop and
>> >> multiplying the coefficients by exp(-i*w*k). I
understand that
>> > this
>> >> should be the same, but my results don't confirm this.
Can
>> anyone
>> >> explain that?
>> >>
>> >> I need the program (especially the multivariate
extension of
>> it),
>> >> because I want to calculate coherency of two time
series, but
>> the
>> >> nonparametric estimators need too much data, so I need
a
>> > parametric
>> >> one, but it is not implemented anywhere.
>> >
>> > If you need to compute the coherence between data series,
>> > consult
>> >
>> > Bendat & Piersol: "Random Data", 3rd ed.,
>> > Wiley, 2000.
>> >
>> > Don't expect parametric models to be of much help.
Coherence
>> > computations include phase information, which is lost in
AR
> models.
>> >
>> > If matlab's for-loops take too long, consider implementing
the
>> > computations as MEX files.
>> >
>> > Rune
>> >
>> >
>
>

Subject: Multivariate parametric spectral estimation wi

From: Rune Allnor

Date: 25 Apr, 2005 01:10:14

Message: 8 of 8

Ouch! I had a different thread in mind when I wrote
the first post this morning. A couple of days ago I wrote
a post over sum-of-sine models and subspace-based methods
in the thread

http://groups-beta.google.com/group/comp.soft-sys.matlab/browse_frm/thread/7f16457c8d4d1371/0ff980e13d58f690?q=allnor&rnum=2#0ff980e13d58f690

and it was that question I had in the back of my mind this
morning. So be a bit careful about how you phrase your mail
when you approach the authors!

To summarize: Phase information is a problem in AR models, while
amplitude (and phase) information are problematic in sum-of-sine
models. You need both the amplitude and phase to compute
coherency. Which means parametric models would almost certainly
cause big trouble. They do certainly demand great causion.

Rune

Martin Uebele wrote:
> A'Hearn/Woitek use an AR-model and calculate the coefficients by
> least squares. I use A. Schloegl's tsa-toolbox and calculate the
> coefficients by the Nutall-Strand method. The same toolbox also
> calculates coherency from AR/ARMA-parameters. When I simulate two
> sine waves with known frequencies my programme yields lower explained
> frequency the greater the difference is between the frequencies.
>
> I will discuss your objections with the authors of the mentioned
> paper, who I have some contact with. Thanks for giving me that
> advise!
>
> Rune Allnor wrote:
> >
> >
> >
> > Martin Uebele wrote:
> >> Rune, thanks for your answer! However, I'm very confused,
> because
> > I'm
> >> trying to use the same procedure as in the paper
> >>
> >> A'Hearn, Brian and Ulrich Woitek (2001): More international
> > evidence
> >> on business cycles, Journal of Monetary Economics, 47, 321-346,
> >>
> >> where they calculate explained variance in the frequency domain
> > from
> >> squared coherency, and get the spectrum matrix from
> coefficients
> > of a
> >> multivariate autoregression.
> >
> > Did they use the method you tried? Did they use regression models
> > based on sums-of-sines, or more standard AR/ARMA methods?
> > Did they estimate amplitude spectra from the data, or only
> > spectral shapes?
> >
> >> Do you really mean that's not possible? With my short time
> series
> >> nonparametric analysis does not make sense I understand.
> >
> > I wouldn't state it quite as pointed as that. I would be very,
> > very careful, though, before I accept the results from an
> > analysis based on parametric methods in general, and sum-of-sine
> > methods in particular. It would take a great deal of persuation
> > before I accepted the claims:
> >
> > - I would require a theoretical study of the method, which
> > results would clearly and consistently refute my rather
> > naively stated (but not irrelevant!) first objections
> > - I would require simulation studies, including bad signal
> > models and added noise, that support the theoretical
> > results that as of yet have not been presented
> > - I would require all the preparations above to be reproduced
> > and confirmed by independent analysts
> > - I would not use the method until I understood the theory
> > myself and had conducted my own simulation studies to
> > see that the claims hold, and how the methods break
> > down with poor models and added noise
> >
> > And even if all the above should check out some day, I would be
> > very, very careful with what I do and how I use the method,
> > regardless of whether it's based on the sum-of-sines or some
> > AR/ARMA type of model.
> >
> > Rune
> >
> >> Rune Allnor wrote:
> >> >
> >> >
> >> >
> >> > Martin Uebele wrote:
> >> >> Hi,
> >> >>
> >> >> I calculated the spectrum from AR-coefficients one
> time with
> >> the
> >> > help
> >> >> of the fft-function and the other time by using a
> for-loop and
> >> >> multiplying the coefficients by exp(-i*w*k). I
> understand that
> >> > this
> >> >> should be the same, but my results don't confirm this.
> Can
> >> anyone
> >> >> explain that?
> >> >>
> >> >> I need the program (especially the multivariate
> extension of
> >> it),
> >> >> because I want to calculate coherency of two time
> series, but
> >> the
> >> >> nonparametric estimators need too much data, so I need
> a
> >> > parametric
> >> >> one, but it is not implemented anywhere.
> >> >
> >> > If you need to compute the coherence between data series,
> >> > consult
> >> >
> >> > Bendat & Piersol: "Random Data", 3rd ed.,
> >> > Wiley, 2000.
> >> >
> >> > Don't expect parametric models to be of much help.
> Coherence
> >> > computations include phase information, which is lost in
> AR
> > models.
> >> >
> >> > If matlab's for-loops take too long, consider implementing
> the
> >> > computations as MEX files.
> >> >
> >> > Rune
> >> >
> >> >
> >
> >

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us