Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Truncating x-axis in kernel density graphs

Subject   st: RE: Truncating x-axis in kernel density graphs
Date   Thu, 27 Nov 2003 19:10:06 +0100

An alternative to working in log and back-transform the density might here 
be to use an adaptive kernel density estimate (-findit akdensity- for 
files and material).

The following lines should get you near what you want:

* 1/ get -akdensity-
net from
net install st0037
* 2/ estimate the density and save the coordinates
akdensity XXX , nograph gen(x fx)
* plot in the range you want
tw line fx x if x<ZZZ

Hope this helps,


Philippe Van Kerm
 BP48, L-4501 Differdange
 G.-D. Luxembourg


st: RE: Truncating x-axis in kernel density graphs

Ramani Gunatilaka

> I am plotting kernel density functions of per capita 
> household consumption for three years on the same graph.
> All three distributions are skewed to the left and have 
> very long tails extending to the right.
> I would like to truncate the x axis at a certain 
> consumption value so that the long tail is dropped and the 
> area where all the action is, stretched across so that the 
> changes are more visible.
> I have explored the graph scale options and Stata list 
> archives but couldn't find anything that related to my 
> particular problem. 
> If I were to specify a shorter range of consumption values 
> than the entire data set, wouldn't it distort results?
> Would anyone be able to advise of any alternative?

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept for the presence of computer viruses.


*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index