[R] help! - spectral analysis - spec.pgram

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Mar 27 16:58:54 CET 2008


On Thu, 27 Mar 2008, Nuno Prista wrote:

> Can someone explain me this spec.pgram effect?
>
>
>
> Code:
>
>
>
> period.6<-c(0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10
> ,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10)
>
> period.5<-c(0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10
> ,0,0,0,0,10,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10,0,0,0,0,10,0)
>
>
>
> par(mfrow=c(2,1))
>
>
>
> spec.pgram(period.6, log="no")
>
> spec.pgram(period.5, log="no")
>
>
>
>
>
> The first series has period 6 and shows its periodicity in 1/6 and
> harmonics. In the second series I was expecting to see a signal occurring at
> frequency 1/5 but it does not. Can anybody explain me why?

Because it does not have period 5 but 12 ....

With such short series tapering has some effect. Try

x <- rep(c(0,0,0,0,0,10,0,0,0,0,10,0), 100)
spec.pgram(x, log="no")

>
>
>
> Thanks in advance,
>
>
>
> Nuno
>
>
>
> ______________________________________________
>
> Centro de Oceanografia - IO-FCUL, Portugal
>
> Center for Quantitative Fisheries Ecology - ODU, USA
>
> email: nmprista*@fc.ul.pt ; nprista*@odu.edu
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list