scipy.stats - get a lognormal's underlying mu and sigma












1















In Python's scipy.stats library, it has a very stylized set of random variable classes, methods, and attributes. Most relate to the distribution itself, e.g., "what is the mean?" or "what is the variance?"



The lognormal distribution is an oddball because the parameters that define it are not the usual parameters for the distribution, but the parameters for a normal distribution that it derives from. Simply put, if X is a normal distribution with mean mu and stdev sigma, Y=e^X is a lognormal that has its own means, mode, variance, stdev, etc.



Does anyone know of a quick or clever way to recover the underlying mu and sigma (of the normal distribution X) via methods or attributes of a 'frozen' RV in scipy.stats?



Since scipy.stats does give the mean, stdev, etc., of the actual lognormal, one could do a lot of algebra and recover it from the standard translations...but the code is likely unmaintainable.



For reference< see:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.lognorm.html
and
https://en.wikipedia.org/wiki/Log-normal_distribution










share|improve this question



























    1















    In Python's scipy.stats library, it has a very stylized set of random variable classes, methods, and attributes. Most relate to the distribution itself, e.g., "what is the mean?" or "what is the variance?"



    The lognormal distribution is an oddball because the parameters that define it are not the usual parameters for the distribution, but the parameters for a normal distribution that it derives from. Simply put, if X is a normal distribution with mean mu and stdev sigma, Y=e^X is a lognormal that has its own means, mode, variance, stdev, etc.



    Does anyone know of a quick or clever way to recover the underlying mu and sigma (of the normal distribution X) via methods or attributes of a 'frozen' RV in scipy.stats?



    Since scipy.stats does give the mean, stdev, etc., of the actual lognormal, one could do a lot of algebra and recover it from the standard translations...but the code is likely unmaintainable.



    For reference< see:
    https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.lognorm.html
    and
    https://en.wikipedia.org/wiki/Log-normal_distribution










    share|improve this question

























      1












      1








      1








      In Python's scipy.stats library, it has a very stylized set of random variable classes, methods, and attributes. Most relate to the distribution itself, e.g., "what is the mean?" or "what is the variance?"



      The lognormal distribution is an oddball because the parameters that define it are not the usual parameters for the distribution, but the parameters for a normal distribution that it derives from. Simply put, if X is a normal distribution with mean mu and stdev sigma, Y=e^X is a lognormal that has its own means, mode, variance, stdev, etc.



      Does anyone know of a quick or clever way to recover the underlying mu and sigma (of the normal distribution X) via methods or attributes of a 'frozen' RV in scipy.stats?



      Since scipy.stats does give the mean, stdev, etc., of the actual lognormal, one could do a lot of algebra and recover it from the standard translations...but the code is likely unmaintainable.



      For reference< see:
      https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.lognorm.html
      and
      https://en.wikipedia.org/wiki/Log-normal_distribution










      share|improve this question














      In Python's scipy.stats library, it has a very stylized set of random variable classes, methods, and attributes. Most relate to the distribution itself, e.g., "what is the mean?" or "what is the variance?"



      The lognormal distribution is an oddball because the parameters that define it are not the usual parameters for the distribution, but the parameters for a normal distribution that it derives from. Simply put, if X is a normal distribution with mean mu and stdev sigma, Y=e^X is a lognormal that has its own means, mode, variance, stdev, etc.



      Does anyone know of a quick or clever way to recover the underlying mu and sigma (of the normal distribution X) via methods or attributes of a 'frozen' RV in scipy.stats?



      Since scipy.stats does give the mean, stdev, etc., of the actual lognormal, one could do a lot of algebra and recover it from the standard translations...but the code is likely unmaintainable.



      For reference< see:
      https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.lognorm.html
      and
      https://en.wikipedia.org/wiki/Log-normal_distribution







      python-3.x scipy






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 17 '18 at 5:51









      eSurfsnakeeSurfsnake

      279110




      279110
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348629%2fscipy-stats-get-a-lognormals-underlying-mu-and-sigma%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348629%2fscipy-stats-get-a-lognormals-underlying-mu-and-sigma%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)