<>
You do get the correct graph with:
*************
clear
cap graph drop _all
set obs 1000
g x=exp(rnormal())
su x, de
hist x if x<`r(p95)', name(ha)
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Antoine
Terracol
Gesendet: Donnerstag, 4. Februar 2010 13:24
An: [email protected]
Betreff: Re: st: -if- and r() in -histogram-
<>
of course, all the "hist" below should be "kdensity", and the correct
piece of code is
/**********************/
clear
cap graph drop _all
set obs 1000
g x=exp(rnormal())
su x, de
local p95=r(p95)
di r(p95)
kdensity x if x<r(p95), name(ka)
kdensity x if x<`p95', name(kb)
kdensity x, name(kc)
/************************/
Antoine Terracol wrote:
Now, I have not tried all types of graphs, but -kdensity- seems to
behave as expected:
/**********************/
clear
cap graph drop _all
set obs 1000
g x=exp(rnormal())
su x, de
local p95=r(p95)
di r(p95)
hist x if x<r(p95), name(ka)
hist x if x<`p95', name(kb)
hist x, name(kc)
/************************/
Best,
Antoine