Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: CDF log-normal and histogram
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: RE: CDF log-normal and histogram
Date
Mon, 14 Feb 2011 12:17:45 +0000
No; there is no such option. If there were, it would surely be documented.
(Your typo of "historgam" is easily corrected, and is not the issue.)
However, there is a solution similar in spirit to that conveyed to you earlier:
. sysuse auto, clear
(1978 Automobile Data)
. gen lnprice = ln(price)
. su lnprice
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
lnprice | 74 8.640633 .3921059 8.098947 9.674452
. histogram price, ///
legend(off) ///
addplot(function ///
(1 / (x * `r(sd)' * sqrt(2 * _pi))) * ///
exp(-(ln(x) - `r(mean)')^2 / (2 * `r(Var)')), ra(1 16000))
You'd need to check my formula, but the example looks about right.
Nick
On Mon, Feb 14, 2011 at 11:53 AM, Beatrice Crozza
<[email protected]> wrote:
> Dear Nick and Maarten,.
>
> Thank you very much for your answers.
>
> Is there a way to write the following command with a longnormal insted
> of a normal?
>
> histogram var1, freq normal
>
> I tried:
> historgam var1, freq lognormal
>
> but doesn't work.
>
> Thank you very much.
>
> Bea
>
>
>
> 2011/2/12 Maarten buis <[email protected]>:
>> --- Beatrice Crozza
>>> I want to have a graph which combine the histogram of
>>> frequencies for my variable and on the same graph an
>>> empirical CDF of data and a fitted CDF (log-normal)
>>
>> --- On Fri, 11/2/11, Nick Cox wrote:
>>> Not the graph I would use in that territory.
>>>
>>> See -lognfit- (Stephen Jenkins, SSC) and -qlogn- from
>>> -qpfit- (SSC) for more critical choices.
>>
>> Yet another options that remains closer to the histogram
>> theme while solving some of the difficulties Beatrice's
>> graph would be -hangroot- (see: -ssc d hangroot- or
>> <http://www.maartenbuis.nl/software/hangroot.html>)
>>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/