Dear list,

I had some confusion regarding what function too use in order too relate

results from spec.pgram() too a chi-square distribution. The documentation

indicates that the PSD estimate can be approximated by a chi-square

distribution with 2 degrees of freedom, but I am having trouble figuring out

how to do it in R, and figuring out what specifically that statement in the

documentation means. I have very little exposure to distribution functions

in R.

I have started with a signal that is simply a sine function, with a visible

periodicity within the nyquist range.

>a <- sin(2*pi *(0:127)/16)

>plot(a, type="l")

I then get the raw power spectrum using, for instance:

>PSD <- spec.pgram(a, spans=NULL, detrend=F)

Next I did a search for information on chi-square.

>help.search("chi square")

. provided a list of potentials, of which Chisquare() seemed to fit because

it mentioned the distribution.

>?Chisquare

. provided the documentation, which shows four functions and their

descriptions. I've assumed that I need too use dchisq() for my purposes, so

that the fitted distribution would be: [assuming the power returned by

spec.pgram() ARE regarded as quantiles.]

>plot(dchisq(PSD$spec, df=2))

. but the values are not between (0,1).

>plot(PSD$freq, pchisq(PSD$spec, df=2, lower.tail=F))

. looks better because values range from 0-1.

Please clarify how to fit the PSD estimate to a chi-square distribution and

any transforms that may be needed to get the quantiles from the PSD. Is what

I tried what the documentation 'had in mind' when it says "df: The

distribution of the spectral density estimate can be approximated by a chi

square distribution with 'df' degrees of freedom." ? If so, what is the

appropriate function call too use (pchisq(), dchisq(), or qchisq())? If not,

what function should I consider?

Thanks in advance,

Keith C.

[[alternative HTML version deleted]]

______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html