[Numpy-discussion] Correlated distributions (?)
Thu Aug 16 15:58:13 CDT 2012
On Thu, Aug 16, 2012 at 3:27 PM, Andrea Gavana <firstname.lastname@example.org>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)
> 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)
Then you have 3 probabilities to choose any amount of dependence, and
(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.
> Thank you in advance.
> "Imagination Is The Only Weapon In The War Against Reality."
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion