Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plot Lognormal knowing ONLY values for parameters

    Hello everybody.
    How can i plot a lognormal distribution having only knowledge of the parameters? No data at all.

    Example:
    mu= 10.1611 and sigma=0.7012

    Thanks to all

  • #2
    Alfonso: Using —twoway function— should be an easy way to do this. Assuming you want the density, perhaps try something like this:
    Code:
    local m=10.1611
    local s=.7012
    twoway function y=(1/(`s'*sqrt(2*_pi)*x))*exp(-(ln(x)-`m')^2/(2*`s'^2)), range(.001 100000)
    A shortcut is to use the —normalden(.)— function:
    Code:
    twoway function y=(1/(`s'*x))*normalden((ln(x)-`m')/`s'), range(.001 100000)
    You can of course specify the range to be whatever is appropriate for your application, and also use the other —twoway— options that may be desirable.

    Comment


    • #3
      P.S. An even more concise expression uses the 3-parameter version of —normalden—
      Code:
      twoway function y=(1/x)*normalden(ln(x),`m',`s'), range(0 100000)
      Last edited by John Mullahy; 22 Jun 2017, 07:18. Reason: Error in previous posting: The 3-parameter version of —normalden— will already have incorporated the (1/`s') factor that I had mistakenly included in the original #3. I apologize for any confusio

      Comment


      • #4
        Ok. Fine. Now the problem comes with the assix. I included the xscale(log) option to rescale the assix but i got something like the imagine i have attached. How can i add more thicks to the left of 50000? Despite trying different options for range(xx xxxx) it changes only the section of the distribution, and not the value on the x assix.Graph.pdf

        Comment


        • #5
          Alfonso: You can control the x-axis label locations and ticks using the -xlabel- option. For example, consider the code
          Code:
          twoway function y=(1/x)*normalden(ln(x),`m',`s'), range(1000 100000) xscale(log) xlabel(1000 10000 100000)
          Of course, you can specify whatever values are helpful for you in -xlabel(…)-

          Comment

          Working...
          X