[Numpy-discussion] Correlated distributions (?)

josef.pktd@gmai... josef.pktd@gmai...
Thu Aug 16 15:58:13 CDT 2012


On Thu, Aug 16, 2012 at 3:27 PM, Andrea Gavana <andrea.gavana@gmail.com>wrote:

> Hi All,
>
>     once again, my apologies for a (possibly) very ignorant question,
> my google-fu is failing me... also because I am not sure of what
> exactly I should look for.
>
> My problem is relatively simple. Let's assume I have two Python
> objects, A and B, and one of their attributes can assume a value of
> "True" or "False" depending on the results of a uniform random
> distribution sample, i.e.:
>
> probability_A = 0.95
> probability_B = 0.86
>
> A.has_failed = False
> B.has_failed = False
>
> if numpy.random.random() < probability_A:
>     A.has_failed = True
>
> if numpy.random.random() < probability_B:
>     B.has_failed = True
>
> Now, I know that there is a correlation factor between the failing/not
> failing of A and the failing/not failing of B. Specifically, If A
> fails, then B should have 80% more chance of failing, but I have been
> banging my head to find out how I should modify the "probability_B"
> number (or the extremes of the uniform distribution, if that makes
> sense) in order to reflect that correlation.
>
> I have been looking at correlated distributions, but it appears that
> most of the results I have found relate to normal distributions, there
> is very little about non-normal (and especially uniform)
> distributions.
>
> It's also very likely that I am not looking in the right direction, so
> I would appreciate any suggestion you may share.
>

easiest, I guess, is to work with a discrete distribution with 4 states,
where states reflect the joint event (a, b)
True, True
True, False
...

Then you have 3 probabilities to choose any amount of dependence, and
marginal probabilities.

(more complicated, correlated Probit)

to generate random numbers, a recipe of Charles on the mailing list, or a
new version of numpy might be helpful.


Josef


>
> Thank you in advance.
>
> Andrea.
>
> "Imagination Is The Only Weapon In The War Against Reality."
> http://xoomer.alice.it/infinity77/
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120816/a96b679a/attachment-0001.html 


More information about the NumPy-Discussion mailing list