Message Boards Message Boards

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

Moments of a generic random variable (symbolic)

Posted 10 years ago

Hi, I'm having trouble to find how write moments of random variables in symbolic terms. For instance, say I define z = x + y then I want to compute the variance of z in terms of moments of x and y. I would like Mathematica to return this:

Variance(z) = variance(x) + variance(y) + 2*covariance(x,y)

(All in symbolic terms)

My actual problem is a bit more complicated. I have that the data generating process of a scalar random variable X is an AR(p):

$X_{t} = \sum_{j=1}^{p} A_{j} X_{t-j} + u_{t}$

where $A_{j}$'s are scalars, for some white noise $u_{t}$. I don't want to specify a distribution for $u_{t}$, and there is NO data nor estimation involved. This is a population exercise.

I want to compute the variance of $X_{t}$ as a function of $p$, the $A_{j}$'s, and probably the variance of $u_{t}$. The process is stationary.

MY QUESTION: can mathematica give me the expression of Variance( $X_{t}$ ) in symbolic terms?

Thanks!!!! All help/comments welcome!

PS Just in case I'm familiar with the well known formula for it, but I don't want to write that directly. I want mathematic to tell me the expression. The reason is that I also have more complicated processes to look into where deriving the variance is a mess, so I would like mathematica to do it for me. For instance, I have VAR(p) processes for X and Y.

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
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