Histogram Command

From GeoGebra Manual
Revision as of 00:01, 21 May 2011 by Gsturr (talk | contribs)
Jump to: navigation, search



Histogram[<List of Class Boundaries>, <List of Heights>]
Creates a histogram with bars of the given heights. The class boundaries determine the width and position of each bar of the histogram.
Example: Histogram[{0, 1, 2, 3, 4, 5}, {2, 6, 8, 3, 1}] creates a histogram with 5 bars of the given heights. The first bar is positioned at the interval [0, 1], the second bar is positioned at the interval [1, 2], and so on.


Histogram[<List of Class Boundaries>, <List of Raw Data>, <Boolean Use Density>, <Density Scale Factor>(optional)]
Creates a histogram using the raw data. The class boundaries determine the width and position of each bar of the histogram and are used to determine how many data elements lie in each class. Bar height is determined as follows
If Use Density = true,
height = (Density Scale Factor) * (class frequency) / (class width)
If Use Density = false,
height = class frequency
By default, Use Density = true and Density Scale Factor = 1. This creates a histogram with total area = n, the number of data values.


Example: (Default Histogram)
Histogram[{10, 20, 30, 40}, {10, 11, 11, 12, 18, 20, 25, 40}, true] creates a histogram with 3 bars, with the heights 0.5 (first bar), 0.2 (second bar), and 0.1 (third bar).
This histogram has total area = 0.5*10 + 0.2*10 + 0.1*10 = 8.


Example: (Count Histogram)
Histogram[{10, 20, 30, 40}, {10, 11, 11, 12, 18, 20, 25, 40}, false] creates a histogram with 3 bars, with the heights 5 (first bar), 2 (second bar), and 1 (third bar). This histogram does not use density scaling and gives bar heights that equal the count of values in each class.


Example: (Relative Frequency Histogram)
Histogram[{10, 20, 30, 40}, {10, 11, 11, 12, 18, 20, 25, 40}, false] / 8 creates a histogram with 3 bars, with the heights 5/8 (first bar), 2/8 (second bar), and 1/8 (third bar). This histogram does not use density scaling and gives bar heights that equal the proportion of values in each class.
Note: When the Histogram command is divided or multiplied by a number then each bar height is divided or multiplied by that number. In this case the Histogram command was divided by the number of data values.


Example: (Normalized Histogram)
Histogram[{10, 20, 30, 40}, {10, 11, 11, 12, 18, 20, 25, 40}, true, 1/8] creates a histogram with 3 bars, with the heights .0625 (first bar), .025 (second bar), and .0125 (third bar).
This histogram has total area = .0625*10 + .025*10 + .0125*10 = 1.
If n is the number of data values, then Density Scale Factor = 1/n creates a normalized histogram with total area = 1. This is useful for fitting a histogram with a density curve.


Histogram[ <Boolean Cumulative>, <List of Class Boundaries>, <List of Raw Data>, <Boolean Use Density> , <Density Scale Factor> (optional) ]
If Cumulative is true this creates a histogram where each bar height equals the frequency of the class plus the sum of all previous frequencies.
Example: :Histogram[true, {10, 20, 30, 40}, {10, 11, 11, 12, 18, 20, 25, 40}, true] creates a histogram with 3 bars, with the heights 5 (first bar), 7 (second bar), and 8 (third bar).
© 2024 International GeoGebra Institute