Just curious: did you read the help page to see what the "fast"
argument does? If you did, why are you surprised at this result?
Duncan Murdoch
On 19/10/2020 1:53 p.m., Jade Mosley via R-help wrote:
Dear all,
This is potentially a bug in spec.pgram, when the number of samples is
odd,spec.pgramreturns a different result withfast = TRUE, the example below
contains the two varieties with a reference spectrum calculated manually. the
number of returned spectra is also larger (50 compared to 49) whenfast = TRUE
x <- rnorm(
99
)
plot(spec.pgram(x, taper =
0
, detrend =
FALSE
, plot =
FALSE
, fast =
FALSE
)$spec, ty =
'l'
)
lines(spec.pgram(x, taper =
0
, detrend =
FALSE
,plot =
FALSE
, fast =
TRUE
)$spec, col =
'red'
)
lines(((abs(fft(x))^
2
)[
2
:
50
])/
99
, col =
'blue'
, lty =
2
)
Best regards
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.