# Moments of a generic random variable (symbolic)

GROUPS:
 Daniela Scida 1 Vote 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.
2 years ago
6 Replies
 Jim Baldwin 2 Votes You might consider the mathStatica book/package at mathstatica.comAlso, you have a minor typo: "- 2 * covariance(x,y)" should be "+ 2 * covariance(x,y)".
2 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!)
2 years ago
 Yes, one does need to purchase mathStatica but it is well worth it.
2 years ago
 Awesome! Thanks! I'll keep that in mind.