Next: histograms/@Hist, Previous: geometry, Up: Directory Index [Contents][Index]
Creates a histogram representing a delta function at a given value
delta function histogram
location of delta function
createDeltaHist(1.23);
Creates a histogram representing a Gaussian PDF with given mean and standard deviation
Gaussian PDF histogram
mean
mean of the Gaussian distribution
std
standard deviation
binsize
histogram bin-size (default = "std" / 10)
domain
constrain all samples to lie within this interval [min(domain), max(domain)]
hgrm = createGaussianHist(1.2, 3.4, "binsize", 0.1); sert(abs(meanOfHist(hgrm) - 1.2) < 0.1) sert(abs(sqrt(varianceOfHist(hgrm)) - 3.4) < 0.1)
Evaluate the cumulative distribution function (c.d.f) of a histogram.
histogram object
argument to the c.d.f.
dimension over which to evaluate the c.d.f.
hgrm = Hist(2, {"lin", "dbin", 0.1}, {"lin", "dbin", 0.1}); hgrm = addDataToHist(hgrm, [octforge_normrnd(1.7, sqrt(2.3), 1e7, 1), rand(1e7, 1)]); sert(abs(cumulativeDistOfHist(hgrm, 1.7 - sqrt(2.3), 1) - octforge_normcdf(-1)) < 0.005) sert(abs(cumulativeDistOfHist(hgrm, 1.7, 1) - octforge_normcdf(0)) < 0.005) sert(abs(cumulativeDistOfHist(hgrm, 1.7 + sqrt(2.3), 1) - octforge_normcdf(+1)) < 0.005) sert(max(abs(cumulativeDistOfHist(hgrm, 0.33, 2)(50:end-50) - 0.33)) < 0.05) sert(max(abs(cumulativeDistOfHist(hgrm, 0.77, 2)(50:end-50) - 0.77)) < 0.05)
Returns the mean(s) of a histogram.
histogram object
dimension to calculate mean(s) over
hgrm = Hist(2, {"lin", "dbin", 0.01}, {"lin", "dbin", 0.1}); hgrm = addDataToHist(hgrm, [octforge_normrnd(1.7, 4.3, 1e6, 1), rand(1e6, 1)]); sert(abs(meanOfHist(hgrm) - 1.7) < 5e-2)
Computes the moments of a histogram: Only moments for finite bins are returned.
integral over x{sumdims=sd} of p(x{sd(1)},...,x{sd(end)}) * (x{sd(1)}-x0{sd(1)})^n{sd(1)} * … * (x{sd(end)}-x0{sd(end)})^n{sd(end)} dx{sd(1)} ... dx{sd(end)}
histogram object
dimensions to be summed over
moment orders in each summed dimension
bin offsets, must either be a scalar or match the sizes of the histogram dimensions *not* being summed over
hgrm = createGaussianHist(1.2, 3.4, "binsize", 0.1); sert(momentOfHist(hgrm, 1, 0), 1.0, 1e-3) sert(momentOfHist(hgrm, 1, 1), 1.2, 1e-3) sert(momentOfHist(hgrm, 1, 2, 1.2), 3.4.^2, 1e-3) sert(momentOfHist(hgrm, 1, 3, 1.2), 0.0, 1e-3)
Plot a histogram as a stair graph
histogram object
options to pass to graphics function
return graphics handles
plotHist()
-specific optionsstairs
if true [default], plot histogram as a stair-stepped graph; otherwise, plot a smooth line through bin centres
infbins
if true [default], plot stalks for counts in infinite bins
fig = figure("visible", "off"); hgrm = createGaussianHist(1.2, 3.4, "binsize", 0.1); plotHist(hgrm, "k-"); plotHist(hgrm, "k-", "stairs", true); plotHist(hgrm, "k-", "stairs", false); close(fig);
Print the contents of a histogram object as an ASCII table.
histogram object
width of bins to use in each dimension
threshold to apply before printing
hgrm = Hist(2, {"lin", "dbin", 0.01}, {"lin", "dbin", 0.1}); hgrm = addDataToHist(hgrm, [octforge_normrnd(1.7, 4.3, 1e6, 1), rand(1e6, 1)]); showHist(hgrm);
Evaluate the quantile function (q.f.) of a histogram.
histogram object
quantile probability, in the range [0, 1]
dimension over which to evaluate the q.f.
hgrm = Hist(2, {"lin", "dbin", 0.1}, {"lin", "dbin", 0.1}); hgrm = addDataToHist(hgrm, [octforge_normrnd(1.7, sqrt(2.3), 1e7, 1), rand(1e7, 1)]); sert(abs(quantileFuncOfHist(hgrm, octforge_normcdf(-1), 1) - (1.7 - sqrt(2.3))) < 0.01) sert(abs(quantileFuncOfHist(hgrm, octforge_normcdf( 0), 1) - (1.7)) < 0.01) sert(abs(quantileFuncOfHist(hgrm, octforge_normcdf(+1), 1) - (1.7 + sqrt(2.3))) < 0.01) sert(max(abs(quantileFuncOfHist(hgrm, 0.33, 2)(50:end-50) - 0.33)) < 0.05) sert(max(abs(quantileFuncOfHist(hgrm, 0.77, 2)(50:end-50) - 0.77)) < 0.05)
Show the contents of a histogram object.
histogram object
hgrm = createGaussianHist(1.2, 3.4, "binsize", 0.1); showHist(hgrm);
Returns the standard deviation(s) of a histogram.
histogram object
dimension to calculate standard deviation(s) over
hgrm = Hist(2, {"lin", "dbin", 0.01}, {"lin", "dbin", 0.1}); hgrm = addDataToHist(hgrm, [octforge_normrnd(1.7, 4.3, 1e6, 1), rand(1e6, 1)]); sert(abs(stdvOfHist(hgrm) - 4.3) < 5e-2) sert(abs(stdvOfHist(hgrm) - sqrt(varianceOfHist(hgrm))) < 5e-2)
Returns the variance(s) of a histogram.
histogram object
dimension to calculate variance(s) over
hgrm = Hist(2, {"lin", "dbin", 0.01}, {"lin", "dbin", 0.1}); hgrm = addDataToHist(hgrm, [octforge_normrnd(1.7, sqrt(2.3), 1e7, 1), rand(1e7, 1)]); sert(abs(meanOfHist(hgrm) - 1.7) < 5e-2) sert(abs(varianceOfHist(hgrm) - 2.3) < 5e-2)
Next: histograms/@Hist, Previous: geometry, Up: Directory Index [Contents][Index]