dhist: Discrete histogram constructor

View source: R/dhist.R

dhistR Documentation

Discrete histogram constructor

Description

Creates a discrete histogram object of class dhist, with bin locations and masses set to the 1D numeric vectors provided.

Usage

dhist(locations, masses, smoothing_window_width = 0, sorted = TRUE)

Arguments

locations

A 1D numeric vector specifying the discrete locations of the histogram bins

masses

A 1D numeric vector specifying the mass present at each location

smoothing_window_width

If greater than 0, the discrete histogram will be treated as having the mass at each location "smoothed" uniformly across a bin centred on the location and having width = smoothing_window_width (default = 0 - no smoothing)

sorted

Whether or not to return a discrete histogram with locations and masses sorted by ascending mass (default = TRUE)

Value

A sparse discrete histogram. Format is a dhist object, which is a list of class dhist with the following named elements:

  • locations: A 1D numeric vector of discrete locations

  • masses: A 1D numeric vector of the mass present at each location

Note that locations where no mass is present are not included in the returned dhist object. Mass in these discrete histograms is treated as being present precisely at the specified location. Discrete histograms should not be used for data where observations have been grouped into bins representing ranges of observation values.


alan-turing-institute/network-comparison documentation built on June 7, 2022, 10:41 p.m.