help cdfplot-------------------------------------------------------------------------------

Title

Plots the cumulative distribution function

Syntax

cdfplotvarname [if] [in] [weight] [,options]

optionsDescription ------------------------------------------------------------------------- Mainby(varname) specifies a separate c.d.f. to be drawn for each value of varname.normalspecifies that a Gaussian probability curve with the same mean and standard deviation to be superimposed over the c.d.f.samesdspecifies that the normal c.d.f.s use the same same standard deviation.nocdfspecifies that the empirical c.d.f. is not drawn.opt1(twoway_options) specifies the additional graph options for the c.d.f. plot.opt2(twoway_options) specifies the additional graph options for the Gaussian c.d.f. plots . twoway_options any twoway options are applied to the final graph. -------------------------------------------------------------------------

Description

cdfplotplots the sample cumulative distribution function. Distributions can be compared within subgroups defined by a second variable. The best fitting normal (Gaussian) model may be superimposed over the sample c.d.f.

Updating this command using SSCTo obtain the latest version click the following to uninstall the old version

ssc uninstall cdfplot

And click here to install the new version

ssc install cdfplot

Options

by(varname) specifies a separate c.d.f. to be drawn for each value of varname. These are plotted on the same graph for easier comparison.

normalspecifies that a normal probability curve with the same mean and standard deviation to be superimposed over the c.d.f.

samesdis relevant only whenbyandnormaloptions are used together. It specifies that the normal curves with different means have the same standard deviations. This demonstrates the fit of the conventional Gaussian location shift model.

nocdfspecifies that the empirical c.d.f. is not drawn but this option will not work unless the normal option is specified, hence only the smoothed Gaussian c.d.f will be drawn.

opt1(twoway_options)specifies additional graph options for the c.d.f. plots.

opt2(twoway_options)specifies additional graph options for the Gaussian c.d.f. plots.If the

xlogoption is used, thenormaloption causes log-normal distributions to be fitted.

ExamplesUsing the variable

lengthfrom theautodata (click on the following commands in order):

NOTE DATA will be lost when loading new datasysuse auto,replace cdfplot length, normal cdfplot length, by(foreign) cdfplot length, by(foreign) norm saving(mygraph) cdfplot length [fw=rep78], by(foreign) norm saving(mygraph,replace)

Using the variable

bpfrom thebplongdatasysuse bplong,replace cdfplot bp, norm cdfplot bp, by(agegrp) cdfplot bp, by(agegrp) norm

Now to show the use of the options in the individual graphs,

opt1alters the line colours for the c.d.f. graphs andopt2alters the line pattern for the Gaussian c.d.f.cdfplot bp, by(agegrp) opt1( lc(red green olive) ) opt2( lp(dash dash dash) ) norm

AuthorAdrian Mander, MRC Human Nutrition Research Unit, Cambridge, UK.

Email adrian.mander@mrc-hnr.cam.ac.uk

AcknowledgementThis command is nearly a direct port of the

cdfcommand that was written byDavid ClaytonandMichael Hillsin STB-49.

Also seecdf (if installed)