mean of a matrix

What's the standard (or a cool non-standard)  way to compute the expected value of a matrix, e.g., a covariance matrix? Using this code:

restart; with(LinearAlgebra): e1 := Statistics:-RandomVariable(Normal(0, sigma)); L := [seq(e1*cos(pi*t), t = 1 .. 3)]; convert(L, Matrix); Transpose(convert(L, Matrix)); M := Multiply(%, %%); S := map(Statistics:-Mean, M)

how do I simplify S to the matrix of +/- one's and factor out sigma^2 outside the matrix? Thanks. 

 

Robert Israel's picture

Pi

The constant 3.14... is Pi, not pi.  As for taking out the factor sigma^2, you could try factrix in my Maple Advisor Database

www.math.ubc.ca/~israel/advisor

doh! I had this line close

doh! I had this line close to the code above: [seq(Statistics:-Sample(e*cos(Pi*t), 1)[1], t = 1 .. 50)], that is I knew how it should be. Had Pi and pi looked differrently in typset output, i'd have readily identified the problem. I verified by paste&copy  from the output matrix entry, and it did give me the simplification I sought, which let me think of things other than looking back at the code.

Your advisor resourse is great, thank you!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}