Re: Variance
- To: mathgroup at smc.vnet.net
- Subject: [mg52071] Re: Variance
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Tue, 9 Nov 2004 01:37:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 11/8/04 at 3:13 AM, johanfo at gmail.com (JFO) wrote: >Can anybody help me out with this? I'm trying to make mathematica >calculate the variance of an expression, however I don't get the >result I expected, a numerical value. >In[144]:= ><<Statistics`ContinuousDistributions` >a:=NormalDistribution[0,0.1] >b:=NormalDistribution[0,0.1] >c:=NormalDistribution[0,0.1] >z:=0.7a-0.5b-0.8c >Variance[z] > >Out[149]= >Variance[-0.6 NormalDistribution[0,0.1]] The reason you are not getting a numerical value is the function Variance doesn't know how to compute the variance of a general expression. The simplest way to sovle your problem is to realize variance is location independent but not scale independent. That is the variance of m x + b will be m^2 variance(x) The other useful property of variance is it is additive, i.e., variance(x+y) = variance(x) + variance(y) So, the solution is: .1^2(.7^2 + .5^2 + .8^2) If you were did not know the properties of variance above, you could have Mathematica do the computation using the ExpectedValue function, i.e., ExpectedValue[(0.7 #)^2 & , NormalDistribution[0, 0.01]] 0.000049 Since ExpectedValue[x+y] = ExpectedValue[x]+ExpectedValue[y] it should be clear you could solve you problem as a sum of expected values which will clearly be the same result I showed above. -- To reply via email subtract one hundred and four