Message Boards Message Boards

1
|
8006 Views
|
8 Replies
|
9 Total Likes
View groups...
Share
Share this post:

Moments of a generic random variable (symbolic)

Posted 10 years ago
POSTED BY: Daniela Scida
8 Replies
Posted 10 years ago

Your explanation is wonderful!! I think this is exactly what I needed to know to work my setting which is based on this. Thank you so much!!!!!

POSTED BY: Daniela Scida
In[1]:= ARProcess[{Array[a, {2, 2}]}, Array[v, {2, 2}]]

Out[1]= ARProcess[{{{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}}}, {{v[1, 1], v[1, 2]}, {v[2, 1], v[2, 2]}}]

denotes AR process of order p=1, dimension 2. The coefficients of a vector process are defined to be square matrices n by n, where n is the dimension of the process. So to define 2-dimensional AR process of order say p=4 with symbolic coefficients using Array one does:

In[2]:= ARProcess[{Array[a, {4, 2, 2}]}, Array[v, {2, 2}]]

Out[2]= ARProcess[{{{{a[1, 1, 1], a[1, 1, 2]}, {a[1, 2, 1], 
     a[1, 2, 2]}}, {{a[2, 1, 1], a[2, 1, 2]}, {a[2, 2, 1], 
     a[2, 2, 2]}}, {{a[3, 1, 1], a[3, 1, 2]}, {a[3, 2, 1], 
     a[3, 2, 2]}}, {{a[4, 1, 1], a[4, 1, 2]}, {a[4, 2, 1], 
     a[4, 2, 2]}}}}, {{v[1, 1], v[1, 2]}, {v[2, 1], v[2, 2]}}]

One could also use different names for each coefficient matrix:

In[3]:= ARProcess[{Array[a, {3, 3}], Array[b, {3, 3}]}, Array[v, {3, 3}]]

Out[3]= ARProcess[{{{a[1, 1], a[1, 2], a[1, 3]}, {a[2, 1], a[2, 2], 
    a[2, 3]}, {a[3, 1], a[3, 2], a[3, 3]}}, {{b[1, 1], b[1, 2], 
    b[1, 3]}, {b[2, 1], b[2, 2], b[2, 3]}, {b[3, 1], b[3, 2], 
    b[3, 3]}}}, {{v[1, 1], v[1, 2], v[1, 3]}, {v[2, 1], v[2, 2], 
   v[2, 3]}, {v[3, 1], v[3, 2], v[3, 3]}}]

which defines AR process of order 2 and dimension 3, with coefficient matrices a and b, and noise covariance matrix v.

This may also be helpful: ARProcess reference page

POSTED BY: Gosia Konwerska
POSTED BY: Gosia Konwerska
Posted 10 years ago

Gosia this looks awesome! Thank you sooo much!!! Quick (beginners) question:

  • Say you write {Array[a, {2, 4}]} instead of {Array[a, {2, 2}]} in the second example you gave me.
  • Is the number of rows (2) referring to the number of variables in the VAR and the number of columns (4) referring to the number of lags p?

Just want to make sure I interpret correctly (not to mess up when I generalize).

POSTED BY: Daniela Scida
Posted 10 years ago

You might consider the mathStatica book/package at mathstatica.com

Also, you have a minor typo: "- 2 * covariance(x,y)" should be "+ 2 * covariance(x,y)".

POSTED BY: Jim Baldwin
Posted 10 years ago

@Jim

Thanks! I actually looked into mathStatica before, but it seems you need to buy it? (And yes there was a minor, I was tired when I wrote it...Thanks!)

POSTED BY: Daniela Scida
Posted 10 years ago

Yes, one does need to purchase mathStatica but it is well worth it.

POSTED BY: Jim Baldwin
Posted 10 years ago

Awesome! Thanks! I'll keep that in mind.

POSTED BY: Daniela Scida
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract