4
$\begingroup$

I am aware that we can find the expectation under the assumption that x follows some probability distribution, something like this:

Expectation[((1 - x)/x), x \[Distributed] BetaDistribution[alpha, beta]]

However, is it possible to find the variance of the above equation (1-x)/x under the same assumption that x follows a beta distribution?

$\endgroup$

2 Answers 2

6
$\begingroup$

Something like :

Expectation[(((1 - x)/x))^2, x \[Distributed] BetaDistribution[alpha, beta]] -     
(Expectation[((1 - x)/x), x \[Distributed] BetaDistribution[alpha, beta]])^2 // Simplify

(* (beta (-1 + alpha + beta))/((-2 + alpha) (-1 + alpha)^2) *)
$\endgroup$
1
  • $\begingroup$ ah, so we are using the fact that var(x)=E(x^2)-E(X)^2 thanks!! $\endgroup$
    – yyasinta
    Oct 10, 2012 at 14:46
12
$\begingroup$

This is a perfect place to try out TransformedDistribution.

dist = TransformedDistribution[(1 - x)/x, x \[Distributed] BetaDistribution[alpha, beta]];

Variance[dist]

==> (beta (-1 + alpha + beta))/((-2 + alpha) (-1 + alpha)^2)

Edit:

Based on the comments it is worth pointing out that TransformedDistribution rarely auto-evaluates to a known distribution.

This happens when auto-evaluation to a known distribution either isn't possible or hasn't been added yet. That doesn't mean that the result isn't a perfectly good distribution to work with.

Here we see that the distribution remains unevaluated but we can still generate random numbers (and compute just about any other property) and then compare to the theoretical expectation.

Block[{alpha = 5, beta = 2}, 
 ndist = TransformedDistribution[(1 - x)/x, 
   x \[Distributed] BetaDistribution[alpha, beta]];
 rnd = RandomVariate[ndist, 10^5];
 {Head[ndist], N@Variance[dist], Variance[rnd]}
 ]

==> {TransformedDistribution, 0.25, 0.245677}
$\endgroup$
3
  • $\begingroup$ I tried that and gave up because it just returned the TransformedDistribution line unchanged; I didn't know you could still proceed from there. $\endgroup$ Oct 10, 2012 at 15:26
  • 3
    $\begingroup$ Right. That is a common point of confusion. Many things in the Probability and Statistics framework work this way. Also, of note is that using N on an unevaluated result can often give a numeric approximation. $\endgroup$
    – Andy Ross
    Oct 10, 2012 at 15:28
  • $\begingroup$ perfect!! thanks :)) $\endgroup$
    – yyasinta
    Oct 10, 2012 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.