comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: pth order auto-regressive process with a specified mean and variance
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: pth order auto-regressive process with a specified mean and variance [message #79204] Mon, 13 February 2012 09:11 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Yngvar Larsen writes:

> P.S. This is statistical signal processing, so your math books might
> not be the proper place to look for gibberish-to-english
> translation :)

Ah, yeah, I was chasing one of those lithe modern dance
majors and skipped most of that class! ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: pth order auto-regressive process with a specified mean and variance [message #79205 is a reply to message #79204] Mon, 13 February 2012 08:18 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Feb 13, 4:11 pm, David Fanning <n...@idlcoyote.com> wrote:
> Yngvar Larsen writes:
>> Well. Assuming that the parameters of your AR(p) process is
>> chosen such that the process is wide-sense stationary, this should be
>> easy
>
> When did this newsgroup get taken over by people
> seemingly speaking gibberish!? :-(
>
> Cheers,
>
> David
>
> P.S. I'm looking for my long lost math books now...

:)

That sentence was maybe a bit too much for this newsgroup, but on
purpose since OP asked for a simple answer to a complicated question.
(Hence, the "Homework" part of the answer.)

P.S. This is statistical signal processing, so your math books might
not be the proper place to look for gibberish-to-english
translation :)

--
Yngvar
Re: pth order auto-regressive process with a specified mean and variance [message #79209 is a reply to message #79205] Mon, 13 February 2012 07:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Yngvar Larsen writes:

> Well. Assuming that the parameters of your AR(p) process is
> chosen such that the process is wide-sense stationary, this should be
> easy

When did this newsgroup get taken over by people
seemingly speaking gibberish!? :-(

Cheers,

David

P.S. I'm looking for my long lost math books now...



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: pth order auto-regressive process with a specified mean and variance [message #79210 is a reply to message #79209] Mon, 13 February 2012 07:04 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Feb 13, 9:19 am, Tom Van Niel <mookiethe...@gmail.com> wrote:
> Hi Guys,
>
> Does anybody have IDL code that simulates a pth order auto-regressive
> process with a specified mean and variance?  If so, please let me
> know.
>

Well. Assuming that the parameters of your AR(p) process is
chosen such that the process is wide-sense stationary, this should be
easy:

xmean = 0.9
xvariance = 1.2
;; This example vector of AR(4) coefficients
;; results in a WSS process.
;; Homework: make sure this is the case yourself.
;; (Hint: Roots of characteristic polynomial
;; within unit circle)
;; My model:
;; X_t = \sum_{i=1}^p a_iX_{t-i} + n_t
;; with n_t iid normal.
;; Array A below contains (after reverse)
;; A = [a_{p-1}, ..., a_2, a_1]
A = reverse([2.7607, -3.8106, 2.6535, -0.9238])
p = n_elements(A)
transient = 1000 ; Transient throwaway points
npoints = 10000 + transient

drive_proc = sqrt(xvariance)*randomn(seed, npoints)
ar_proc = fltarr(npoints)
ar_proc[0] = drive_proc[0]
for ii=1, p-1 do $
ar_proc[ii] = drive_proc[ii] + $
total(A[p-ii:*]*ar_proc[0:ii-1])

for ii=p, npoints-1 do $
ar_proc[ii] = drive_proc[ii] + $
total(A*ar_proc[ii-p:ii-1])

;; Remove transient points, where
;; the process isn't WSS yet.
;; Add mean value.
ar_proc = ar_proc[transient:*] + xmean

--
Yngvar
Re: pth order auto-regressive process with a specified mean and variance [message #79300 is a reply to message #79210] Mon, 13 February 2012 17:52 Go to previous message
Tom Van Niel is currently offline  Tom Van Niel
Messages: 4
Registered: February 2012
Junior Member
Hi Yngvar,

That is just what I need. At the moment, I'm only using AR(1), so as
long as I keep the parameter < 1, it should remain WSS. If I use
AR(2) or greater, then I'll see if I can figure out the homework you
have assigned :)

David, no need to look up your textbooks when Wikipedia is around,
although it sounds like it brought back some good memories.

Thanks

Yngvar Larsen wrote:
> On Feb 13, 9:19 am, Tom Van Niel <mookiethe...@gmail.com> wrote:
>> Hi Guys,
>>
>> Does anybody have IDL code that simulates a pth order auto-regressive
>> process with a specified mean and variance?  If so, please let me
>> know.
>>
>
> Well. Assuming that the parameters of your AR(p) process is
> chosen such that the process is wide-sense stationary, this should be
> easy:
>
> xmean = 0.9
> xvariance = 1.2
> ;; This example vector of AR(4) coefficients
> ;; results in a WSS process.
> ;; Homework: make sure this is the case yourself.
> ;; (Hint: Roots of characteristic polynomial
> ;; within unit circle)
> ;; My model:
> ;; X_t = \sum_{i=1}^p a_iX_{t-i} + n_t
> ;; with n_t iid normal.
> ;; Array A below contains (after reverse)
> ;; A = [a_{p-1}, ..., a_2, a_1]
> A = reverse([2.7607, -3.8106, 2.6535, -0.9238])
> p = n_elements(A)
> transient = 1000 ; Transient throwaway points
> npoints = 10000 + transient
>
> drive_proc = sqrt(xvariance)*randomn(seed, npoints)
> ar_proc = fltarr(npoints)
> ar_proc[0] = drive_proc[0]
> for ii=1, p-1 do $
> ar_proc[ii] = drive_proc[ii] + $
> total(A[p-ii:*]*ar_proc[0:ii-1])
>
> for ii=p, npoints-1 do $
> ar_proc[ii] = drive_proc[ii] + $
> total(A*ar_proc[ii-p:ii-1])
>
> ;; Remove transient points, where
> ;; the process isn't WSS yet.
> ;; Add mean value.
> ar_proc = ar_proc[transient:*] + xmean
>
> --
> Yngvar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: outputting 2D arrays into a txt file
Next Topic: Using both !p.multi and the position keyword (help?)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:21:08 PDT 2025

Total time taken to generate the page: 0.00549 seconds