[SciPy-User] SciPy-User Digest, Vol 99, Issue 50

bojan.durickovic@gmail.com bojan.durickovic at gmail.com
Wed Dec 21 09:20:59 EST 2011


qYr

Sent from my Verizon Wireless 4G LTE Smartphone

----- Reply message -----
From: scipy-user-request at scipy.org
To: <scipy-user at scipy.org>
Subject: SciPy-User Digest, Vol 99, Issue 50
Date: Sun, Nov 27, 2011 13:00


Send SciPy-User mailing list submissions to
	scipy-user at scipy.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://mail.scipy.org/mailman/listinfo/scipy-user
or, via email, send a message with subject or body 'help' to
	scipy-user-request at scipy.org

You can reach the person managing the list at
	scipy-user-owner at scipy.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of SciPy-User digest..."


Today's Topics:

   1. Re: Power Spectral Density in SciPy, not pylab (Stefan Krastanov)
   2. Confusion about lognormal distribution functions (tazz_ben)
   3. Re: Problem with ODEINT (Lofgren, Eric)
   4. Re: Confusion about lognormal distribution functions (Robert Kern)
   5. Re: Confusion about lognormal distribution functions
      (josef.pktd at gmail.com)


----------------------------------------------------------------------

Message: 1
Date: Sat, 26 Nov 2011 06:32:47 -0800 (PST)
From: Stefan Krastanov <krastanov.stefan at gmail.com>
Subject: Re: [SciPy-User] Power Spectral Density in SciPy, not pylab
To: scipy-user at googlegroups.com
Cc: SciPy Users List <scipy-user at scipy.org>
Message-ID:
	<17684978.61.1322317967157.JavaMail.geo-discussion-forums at yqcw10>
Content-Type: text/plain; charset="utf-8"

A very old question but I had the same problem and google pointed me here. 
Use mlab.

from matplotlib import mlab
powers, freqs = mlab.psd(blah_blah)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20111126/bf9faf4c/attachment-0001.html 

------------------------------

Message: 2
Date: Sat, 26 Nov 2011 16:52:46 +0000
From: tazz_ben <tazz_ben at wsu.edu>
Subject: [SciPy-User] Confusion about lognormal distribution functions
To: "scipy-user at scipy.org" <scipy-user at scipy.org>
Message-ID: <CAF6594C.EDB%tazz_ben at wsu.edu>
Content-Type: text/plain; charset="us-ascii"

Hi Group -

So, what I'm trying to do is draw a firm size from a lognormal
distribution in a simulation (I'm using a fortuna RNG outside of the scope
of this question -- why instead of twister deals with my research
question, for this purposes it is just important to say using the built in
random draw from a specific distribution wouldn't work).

But when I do something like this:

from scipy.stats import lognorm

lognorm.ppf(.5,1,50,50)

The numbers that come out make no sense (I'm right in believing "loc" =
"mean" and "scale" = "standard deviation"?). I've tried logging the
numbers, un-logging the numbers, etc.  I'm very confused on what it is
doing.




------------------------------

Message: 3
Date: Sun, 27 Nov 2011 01:41:08 +0000
From: "Lofgren, Eric" <elofgren at email.unc.edu>
Subject: Re: [SciPy-User] Problem with ODEINT
To: "<scipy-user at scipy.org>" <scipy-user at scipy.org>
Message-ID: <81CB87CA-D183-4399-8675-79BFEFDCC175 at unc.edu>
Content-Type: text/plain; charset="us-ascii"

> Eric,
> You have given odeint an initial condition of length 5, but the function
> that defines your system is returning a vector of only length 3.  Don't do
> that.
> ...

> Warren

Warren-

This does indeed seem to solve the problem, I haven't hit any errors in 1,000 or so runs, and it does indeed make the code run considerably faster. Thank you for the advice and help.

Eric



------------------------------

Message: 4
Date: Sun, 27 Nov 2011 17:39:04 +0000
From: Robert Kern <robert.kern at gmail.com>
Subject: Re: [SciPy-User] Confusion about lognormal distribution
	functions
To: SciPy Users List <scipy-user at scipy.org>
Message-ID:
	<CAF6FJis8jX_++qq285+AHk6JLNhAuyzAbh9QrFCHnotvoG0-=w at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Sat, Nov 26, 2011 at 16:52, tazz_ben <tazz_ben at wsu.edu> wrote:
> Hi Group -
>
> So, what I'm trying to do is draw a firm size from a lognormal
> distribution in a simulation (I'm using a fortuna RNG outside of the scope
> of this question -- why instead of twister deals with my research
> question, for this purposes it is just important to say using the built in
> random draw from a specific distribution wouldn't work).
>
> But when I do something like this:
>
> from scipy.stats import lognorm
>
> lognorm.ppf(.5,1,50,50)
>
> The numbers that come out make no sense (I'm right in believing "loc" =
> "mean" and "scale" = "standard deviation"?). I've tried logging the
> numbers, un-logging the numbers, etc. ?I'm very confused on what it is
> doing.

No, loc and scale mean exactly the same thing for every distribution.
loc translates the distribution linearly and scale scales it.

  lognorm.pdf(x, s, loc=loc, scale=scale) == lognorm.pdf((x-loc)/scale, s)/scale

They don't always map to particular parameters in standard
parameterizations. However, they often do, so doing this lets us share
the code for shifting and scaling in the base class rather than
implementing it slightly differently for every distribution.

In this case, you want to ignore the loc parameter entirely. The scale
parameter corresponds to exp(mu) where mu is the mean of the
underlying normal distribution. The shape parameter is the standard
deviation of the underlying normal distribution.

log(lognorm.ppf(p, s, scale=scale)) == norm.ppf(p, loc=log(scale), scale=s)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
? -- Umberto Eco


------------------------------

Message: 5
Date: Sun, 27 Nov 2011 12:49:24 -0500
From: josef.pktd at gmail.com
Subject: Re: [SciPy-User] Confusion about lognormal distribution
	functions
To: SciPy Users List <scipy-user at scipy.org>
Message-ID:
	<CAMMTP+Dm=CBFRetmVfio1Zg1sog=QMMmdvKyofeVjM0paGgccg at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Nov 27, 2011 at 12:39 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Sat, Nov 26, 2011 at 16:52, tazz_ben <tazz_ben at wsu.edu> wrote:
>> Hi Group -
>>
>> So, what I'm trying to do is draw a firm size from a lognormal
>> distribution in a simulation (I'm using a fortuna RNG outside of the scope
>> of this question -- why instead of twister deals with my research
>> question, for this purposes it is just important to say using the built in
>> random draw from a specific distribution wouldn't work).
>>
>> But when I do something like this:
>>
>> from scipy.stats import lognorm
>>
>> lognorm.ppf(.5,1,50,50)
>>
>> The numbers that come out make no sense (I'm right in believing "loc" =
>> "mean" and "scale" = "standard deviation"?). I've tried logging the
>> numbers, un-logging the numbers, etc. ?I'm very confused on what it is
>> doing.
>
> No, loc and scale mean exactly the same thing for every distribution.
> loc translates the distribution linearly and scale scales it.
>
> ?lognorm.pdf(x, s, loc=loc, scale=scale) == lognorm.pdf((x-loc)/scale, s)/scale
>
> They don't always map to particular parameters in standard
> parameterizations. However, they often do, so doing this lets us share
> the code for shifting and scaling in the base class rather than
> implementing it slightly differently for every distribution.
>
> In this case, you want to ignore the loc parameter entirely. The scale
> parameter corresponds to exp(mu) where mu is the mean of the
> underlying normal distribution. The shape parameter is the standard
> deviation of the underlying normal distribution.
>
> log(lognorm.ppf(p, s, scale=scale)) == norm.ppf(p, loc=log(scale), scale=s)

just as background http://projects.scipy.org/scipy/ticket/1502 and
several mailing list threads.

It's a FAQ. It might be a case for writing a reparameterized wrapper class.

Josef

>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
> ? -- Umberto Eco
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


------------------------------

_______________________________________________
SciPy-User mailing list
SciPy-User at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user


End of SciPy-User Digest, Vol 99, Issue 50
******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20111221/c89482b1/attachment.html>


More information about the SciPy-User mailing list