MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Variance

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52053] Re: [mg52047] Variance
  • From: DrBob <drbob at bigfoot.com>
  • Date: Tue, 9 Nov 2004 01:36:37 -0500 (EST)
  • References: <200411080813.DAA07951@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

The built-in Variance function works on (a) built-in distributions and (b) samples (lists of numbers). It doesn't work on random variables -- which have no definition in Mathematica.

If a, b, and c are independent, the variance of the expression is the sum of variances of the individual terms, and each term's variance is the variance of the random variable (a, b, or c) times the square of the constant. You can calculate that yourself, or you might try code something like this:

Clear[variance]
variance[a] = 0.01;
variance[b] = 0.01;
variance[c] = 0.01;
variance[(x_) + (y_)] := variance[x] + variance[y]
variance[(x_)*(y:a | b | c)] := x^2*variance[y]
variance[0.7*a - 0.5*b - 0.8*c]
0.013800000000000002

To check that answer (or do it this way in the first place):

0.7^2*0.1^2 + 0.5^2*0.1^2 + 0.8^2*0.1^2

0.013800000000000003

Bobby

On Mon, 8 Nov 2004 03:13:38 -0500 (EST), JFO <johanfo at gmail.com> 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]]
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • References:
    • Variance
      • From: "JFO" <johanfo@gmail.com>
  • Prev by Date: Re: NonlinearFit problem
  • Next by Date: Re: NonlinearFit problem
  • Previous by thread: Variance
  • Next by thread: Re: Variance