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]
st: RE: CDF log-normal and histogram
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: CDF log-normal and histogram
Date
Fri, 11 Feb 2011 19:57:28 +0000
Not the graph I would use in that territory.
See -lognfit- (Stephen Jenkins, SSC) and -qlogn- from -qpfit- (SSC) for more critical choices.
But in terms of what you ask, I don't know what "doesn't work" means in your case.
Consider
sysuse auto, clear
gen ln_price = ln(price)
su ln_price
distplot price, ///
addplot(function normal((ln(x) - `r(mean)')/`r(sd)'), lp(dash) ra(1 16000)) ///
legend(order(1 "delicious data" 2 "mad model")) yla(, ang(h))
If you want to fit the distribution in other ways, plug in your parameter estimates accordingly.
Here's a stab at a histogram too:
sysuse auto, clear
gen ln_price = ln(price)
su ln_price
distplot price, ///
addplot(function normal((ln(x) - `r(mean)')/`r(sd)'), lp(dash) ra(1 16000) ///
|| histogram price, fraction bfcolor(none) width(2000)) ///
legend(order(1 "delicious data" 2 "mad model")) yla(, ang(h))
In terms of giving references to user-written stuff as requested:
-distplot- is from SJ.
-dpplot- is from SJ.
Authors not named are me.
Nick
[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)
I can do the histogram in this way:
histogram var1, freq
To see if my variable follows a log-normal I do:
dpplot var1, dist(log-normal)
The CDF of my variable in this way:
distplot var1,
How can I combine the histogram with the empirical CDF and the fitted
CDF (log-normal)?
I tried with twoway but it doesn't work.
Thank you very much for your help.
*
* 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/