Maxima – 235 – descriptive – 12

Dy5L

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.736.

histogram (list)
histogram (list, option_1, option_2, ...)
histogram (one_column_matrix)
histogram (one_column_matrix, option_1, option_2, ...)
histogram (one_row_matrix)
histogram (one_row_matrix, option_1, option_2, ...)
This function plots an histogram from a continuous sample. Sample data must be stored in a list of numbers or a one dimensional matrix.

Available options are:

  • nclasses (default, 10): number of classes of the histogram, or a list indicating the limits of the classes and the number of them, or only the limits. This option also accepts bounds for varying bin widths, or a symbol with the name of one of the three optimal algorithms available for the number of classes: 'fd (Freedman, D. and Diaconis, P. (1981) On the histogram as a density estimator: L 2 theory. Zeitschrift fuer Wahrscheinlichkeitstheorie und verwandte Gebiete 57, 453-476.), 'scott (Scott, D. W. (1979) On optimal and data-based histograms. Biometrika 66, 605-610.), and 'sturges (Sturges, H. A. (1926) The choice of a class interval. Journal of the American Statistical Association 21, 65-66).
  • frequency (default, absolute): indicates the scale of the ordinates. Possible values are: absolute, relative, percent, and density. With density, the histogram area has a total area of one.
  • htics (default, auto): format of the histogram tics. Possible values are: auto, endpoints, intervals, or a list of labels.
  • All global draw options, except xrange, yrange, and xtics, which are internally assigned by histogram. If you want to set your own values for these options, make use of histogram_description. See examples bellow.
  • The following draw-pkg options: key, color, fill_color, fill_density and line_width. See also barsplot.

There is also a function wxhistogram for creating embedded histograms in interfaces wxMaxima and iMaxima.

A simple with eight classes:

(%i1) load ("descriptive")$

(%i2) s1 : read_list (file_search ("pidigits.data"))$

(%i3) histogram (
        s1,
        nclasses = 8,
        title = "pi digits",
        xlabel = "digits",
        ylabel = "Absolute frequency",
        fill_color = grey,
        fill_density = 0.6)$

235-0

Setting the limits of the histogram to -2 and 12, with 3 classes. Also, we introduce
predefined tics:

(%i1) load ("descriptive")$

(%i2) s1 : read_list (file_search ("pidigits.data"))$

(%i3) histogram (
        s1,
        nclasses = [-2,12,3],
        htics = ["A", "B", "C"],
        terminal = png,
        fill_color = "#23afa0",
        fill_density = 0.6)$

Nota: l’opzione terminal = png salva direttamente il grafico senza visualizzarlo.

235-1

Bounds for varying bin widths.

(%i4) s1 : read_list (file_search ("pidigits.data"))$

(%i5) histogram (s1, nclasses = {0,3,6,7,11})$

235-2

Freedmann-Diakonis robust method for optimal search of the number of classes.

(%i6) s1 : read_list (file_search ("pidigits.data"))$

(%i7) histogram(s1, nclasses=fd) $

235-3

histogram_description (...)
Function histogram_description creates a graphic object suitable for creating complex scenes, together with other graphic objects. We make use of histogram_description for setting the xrange and adding an explicit curve into the scene:

(%i1) load ("descriptive")$

(%i2) ( load("distrib"),
        m: 14, s: 2,
        s2: random_normal(m, s, 1000) ) $

(%i3) draw2d(
          grid
          = true,
          xrange = [5, 25],
          histogram_description(
            s2,
            nclasses
            = 9,
            frequency
            = density,
            fill_density = 0.5),
          explicit(pdf_normal(x,m,s), x, m - 3*s, m + 3* s))$

235-4

Posta un commento o usa questo indirizzo per il trackback.

Trackback

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.

%d blogger hanno fatto clic su Mi Piace per questo: