[SciPy-user] cdf and integration for multivariate normal distribution in stats.kde

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Mar 31 11:04:12 EDT 2009


On Tue, Mar 31, 2009 at 4:28 AM, Dave Hirschfeld
<dave.hirschfeld at gmail.com> wrote:
>  <josef.pktd <at> gmail.com> writes:
>
>>
>> On Fri, Mar 20, 2009 at 9:34 AM, Dave <dave.hirschfeld <at> gmail.com> wrote:
>> > I'm currently using the mvncdf.py code you posted to the list but unless I'm
>> > mistaken it hasn't made the cut for 0.7 and there's no enhancement ticket for
>> > it in trac. It's a very useful function for me (and others I'm sure) so it
>> > would be a shame for it to just be forgotten as an list attachment. Should I
>> > file an enhancement ticket?
>> >
>>
>> I'm glad you find it useful.
>>
>> I had added the ticket: http://projects.scipy.org/scipy/ticket/846
>> but there was a typo in the title/summary so searching for
>> "multivariate" didn't find it.
>>
>> Since you seem to be the first user of it, can you provide any
>> comments on the API. Are the functions useful in the way they are, or
>> what changes would yo recommend? You could add some comments to the
>> trac ticket.
>>
>> Thanks,
>>
>> Josef
>>
>
> Sorry for the delayed reply - it's been pretty hectic and I was hoping to
> use/test the code a bit more beforehand.
>
> As it is I'm just using the mvnormcdf function in a gaussian copula to
> simulate correlated random variables with arbitrary marginal distributions.
> The function seems to be working fine for me but as mentioned I've yet to
> test the code very much. Specifying a lower bound for a CDF initially struck
> me as a little strange but -Inf works fine and it gives other users more
> flexibility.

I could convert the lower bound to a keyword argument  with defaults
-inf, so that it doesn't need to be specified in using mvnormcdf.

>
> Thanks for the code, I'm glad it's got a ticket attached. I'll post any
> suggestions I may have (after further testing) on the trac ticket.

I added docstrings to the two functions and attached the file to the
ticket. I didn't change the functions themselves and I still don't
have proper tests. I also added an example for the use of the keywords
to control the numerical precision for the integration.

A question on copulas got me initially started to look for the
multivariate normal cdf. I would be nice to have also the cdf of the
multivariate t distribution by Alan Genz, the author of mvndst.

Do you have a simple example for the normal copula that you are
willing to share for the cookbook?

Thanks for the comments,

Josef



More information about the SciPy-User mailing list