Hi everyone,

first of all, I would like to say that I am a newbie in R, so I apologize in
advance if my questions seem to be too easy for you.

Well, I'm looking for periodicity in histograms. I have histograms of
certain phenomenons and I'm asking whether a periodicity exists in these
data. So, I make a periodogram with the function spec.pgram. For instance,
if I have a histogram h, I call spec.pgram by spec.pgram (h, log="no",
taper=0.5). So, I have some peaks that appear and I would like to interpret
them but I do not know how they are computed and so what a peak with a value
of 10000 represents in comparison with a peak of value 600 with another
histogram.
I looked at the source code of the function spec.pgram to better understand
what is behind. But, when I apply the source code line by line, I've got a
problem. For instance, I make:
>data = scan ("file.txt")
>h = hist (data, breaks=max(data)/5000)
#then I apply the first two lines of the spec.pgram function
>series <- deparse(substitute(h$counts))
>x <- na.action(as.ts(h$counts))
>x
NULL
I do not understand why when I apply the first two lines of the function I
have x which is equal to NULL (which make a mistake in the following lines
of the code) but if I apply the function directly with h$counts it gives me
a result.
So, if someone can explain to me what is the problem and/or how spec.pgram
exactly computes the periodogram and how to interpret it with my data, I
would be so grateful.
And subsidiary questions:
- Is it possible to have the commented source code of the function?
- I do not understand what is the function na.action in the second line of
spec.pgram, so if you can explain it to me.

Thanks in advance for your answers.
Best regards,

Anthony Mathelier

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to