Simulating a time series with a given spectrum

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Simulating a time series with a given spectrum

Roy Mendelssohn - NOAA Federal
Hi All:

Is there a routine in R that allows me to simulate a time series that has a given spectrum?  I have looked at the R Time Series Task view, and have done a web search also, including an article to appear in the handbook of statistics on time series in R, but I don’t see anything offhand.  There are some that will simulate state-space models or for given covariances matrices, but for a variety of reasons I would prefer simulating series with a given spectrum.

Thanks for any help.

-Roy


**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: [hidden email] www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Simulating a time series with a given spectrum

Prof Brian Ripley
On 27/05/2015 16:54, Roy Mendelssohn - NOAA Federal wrote:
> Hi All:
>
> Is there a routine in R that allows me to simulate a time series that has a given spectrum?  I have looked at the R Time Series Task view, and have done a web search also, including an article to appear in the handbook of statistics on time series in R, but I don’t see anything offhand.  There are some that will simulate state-space models or for given covariances matrices, but for a variety of reasons I would prefer simulating series with a given spectrum.

It is relatively simple to do for series of lengths a power of two (and
you can simulate a longer series to achieve this).  Use the spectrum
values to simulate independent complex normals with uniform phase and
variance proportional to the spectral density at the Fourier frequencies
then use the inverse fft() to get the series.

You should be able to copy some code from boot::tsboot()'s 'scramble'
method.

> Thanks for any help.
>
> -Roy
>
>
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new address and phone***
> 110 Shaffer Road
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: [hidden email] www: http://www.pfeg.noaa.gov/


--
Brian D. Ripley,                  [hidden email]
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Simulating a time series with a given spectrum

Roy Mendelssohn - NOAA Federal
Thanks,  I will look at that.

-Roy

> On May 27, 2015, at 9:15 AM, Prof Brian Ripley <[hidden email]> wrote:
>
> On 27/05/2015 16:54, Roy Mendelssohn - NOAA Federal wrote:
>> Hi All:
>>
>> Is there a routine in R that allows me to simulate a time series that has a given spectrum?  I have looked at the R Time Series Task view, and have done a web search also, including an article to appear in the handbook of statistics on time series in R, but I don’t see anything offhand.  There are some that will simulate state-space models or for given covariances matrices, but for a variety of reasons I would prefer simulating series with a given spectrum.
>
> It is relatively simple to do for series of lengths a power of two (and you can simulate a longer series to achieve this).  Use the spectrum values to simulate independent complex normals with uniform phase and variance proportional to the spectral density at the Fourier frequencies then use the inverse fft() to get the series.
>
> You should be able to copy some code from boot::tsboot()'s 'scramble' method.
>
>> Thanks for any help.
>>
>> -Roy
>>
>>
>> **********************
>> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
>> **********************
>> Roy Mendelssohn
>> Supervisory Operations Research Analyst
>> NOAA/NMFS
>> Environmental Research Division
>> Southwest Fisheries Science Center
>> ***Note new address and phone***
>> 110 Shaffer Road
>> Santa Cruz, CA 95060
>> Phone: (831)-420-3666
>> Fax: (831) 420-3980
>> e-mail: [hidden email] www: http://www.pfeg.noaa.gov/
>
>
> --
> Brian D. Ripley,                  [hidden email]
> Emeritus Professor of Applied Statistics, University of Oxford
> 1 South Parks Road, Oxford OX1 3TG, UK

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: [hidden email] www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Simulating a time series with a given spectrum

Pascal Oettli-2
In reply to this post by Roy Mendelssohn - NOAA Federal
On Thu, May 28, 2015 at 12:54 AM, Roy Mendelssohn - NOAA Federal
<[hidden email]> wrote:
> Hi All:
>
> Is there a routine in R that allows me to simulate a time series that has a given spectrum?  I have looked at the R Time Series Task view, and have done a web search also, including an article to appear in the handbook of statistics on time series in R, but I don’t see anything offhand.  There are some that will simulate state-space models or for given covariances matrices, but for a variety of reasons I would prefer simulating series with a given spectrum.
>

Not sure it will totally answer your question, but if you are
interested in simulating random time series having the same power
spectrum but random phases as an input time series, you can visit this
website (http://iri.columbia.edu/~vincent/matlab_function_version1/function_matlab.htm).
There is a Matlab function called "ebisuzaki"
(http://iri.columbia.edu/~vincent/matlab_function_version1/ebisuzaki.htm),
which performs this. Of course, this implies you already have a time
series of known spectrum. This function can easily be rewritten in R.


> Thanks for any help.
>
> -Roy
>
>
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new address and phone***
> 110 Shaffer Road
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: [hidden email] www: http://www.pfeg.noaa.gov/
>
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>
> ______________________________________________
> [hidden email] 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.



--
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

______________________________________________
[hidden email] 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.