HISTOGAUSS
Name
HISTOGAUSS
Purpose
Histograms data and overlays it with a Gaussian. Draws the mean, sigma,
and number of points on the plot.
Calling Sequence
HISTOGAUSS, Sample, A, [XX, YY, GX, GY, /NOPLOT, /NOFIT, FONT=,
CHARSIZE = ]
Input
SAMPLE = Vector to be histogrammed
Output Arguments
A = coefficients of the Gaussian fit: Height, mean, sigma
A[0]= the height of the Gaussian
A[1]= the mean
A[2]= the standard deviation
A[3]= the half-width of the 95% conf. interval of the standard
mean
A[4]= 1/(N-1)*total( (y-mean)/sigma)^2 ) = a measure of
normality
Below: superceded. The formula is not entirely reliable.
A[4]= measure of the normality of the distribution. =1.0, perfectly
normal. If no more than a few hundred points are input, there are
formulae for the 90 and 95% confidence intervals of this quantity:
M=ALOG10(N-1) ; N = number of points
T90=ABS(.6376-1.1535*M+.1266*M^2) ; = 90% confidence interval
IF N LT 50 THEN T95=ABS(-1.9065-2.5465*M+.5652*M^2) $
ELSE T95=ABS( 0.7824-1.1021*M+.1021*M^2) ;95% conf.
(From Martinez, J. and Iglewicz, I., 1981, Biometrika, 68, 331-333.)
XX = the X coordinates of the histogram bins (CENTER)
YY = the Y coordinates of the histogram bins
GX = the X coordinates of the Gaussian fit
GY = the Y coordinates of the Gaussian fit
Optional Input Keywords
/NOPLOT - If set, nothing is drawn
/FITIT If set, a Gaussian is actually fitted to the distribution.
By default, a Gaussian with the same mean and sigma is drawn;
the height is the only free parameter.
CHARSIZE Size of the characters in the annotation. Default = 0.82.
FONT - scalar font graphics keyword (-1,0 or 1) for text
/WINDOW - set to plot to a resizeable graphics window
_EXTRA - Any value keywords to the cgPLOT command (e.g. XTITLE) may also
be passed to HISTOGAUSS
Subroutine Calls
BIWEIGHT_MEAN, which determines the mean and std. dev.
AUTOHIST, which draws the histogram
GAUSSFIT() (IDL Library) which does just that
Revision History
Written, H. Freudenreich, STX, 12/89
More quantities returned in A, 2/94, HF
Added NOPLOT keyword and print if Gaussian, 3/94
Stopped printing confidence limits on normality 3/31/94 HF
Added CHARSIZE keyword, changed annotation format, 8/94 HF
Simplified calculation of Gaussian height, 5/95 HF
Convert to V5.0, use T_CVF instead of STUDENT_T, GAUSSFIT instead of
FITAGAUSS W. Landsman April 2002
Correct call to T_CVF for calculation of A[3], 95% confidence interval
P. Broos/W. Landsman July 2003
Allow FONT keyword to be passed. T. Robishaw Apr. 2006
Use Coyote Graphics for plotting W.L. Mar 2011
Better formatting of text output W.L. May 2012