This function package (where "k" is for "kernel" and "d" is for
"double") is used for generating plots of a nonparametric estimate of
a bivariate density, computed using a Gaussian kernel and a "plug-in"
covariance matrix, possibly applying a smoothing adjustment.

This is accomplished by the function kddensity(), which takes two
compulsory arguments (the series for which you want the plot) and a
third optional one: a bundle with extra options. The function returns
a bundle on output (see below).

Here are the keys you can have in your "options" bundle and their
meaning (some of the above options can also be set from the GUI
interface):

- *dest*: string, either a valid filename or one of the two special
      values "display" and "buffer". Use "display" for displaying the
      plot on screen. With "buffer", the gnuplot code for the plot
      will become available, upon successful completion, in the output
      bundle under the "buffer" key. In all other cases, "dest" is the
      the filename you want your plot saved to.  (default = "display").

- *isos*: scalar, only active for contour plots: indicates the maximum
      number of contour lines you want (default = 6).

- *ngrid*: scalar, the number of grid points at which the density is
       evaluated. The minimum is 4, the maximum is 256. If you pass
       values outside that range, the function will automatically
       force them to the range extrema (default = 61).

- *over*: scalar, indicating by how much to stretch the support of the
      observed variables in the plot; smaller/larger values of "over"
      can be thought of as zooming in/out (default = 1.1)

- *bw_adj*: scalar, bandwidth adjustment factor, a positive scalar. The
      larger this number, the flatter the density. (default = 1).

- *title*: string, the plot's title (default = "Bivariate kernel density
       plot")

- *type*: scalar, 1 for contour plots, 2 for heatmaps (default = 1).

- *xlabel*: string, label to use for the X axis (default = name of series x)

- *ylabel*: string, label to use for the Y axis (default = name of series y)


The returned bundle will contain the same keys as the option bundle,
plus the following:

- *S*: the "covariance matrix" used for the smoothing. This is calculated
using Silvermans's rule of thumb: https://en.wikipedia.org/wiki/Multivariate_kernel_density_estimation#Rule_of_thumb

- *f*: the estimated density, as a matrix with ngrid^2 rows and 3 columns
(the first 2 columns are the x and y coordinates, column 3 is the
estimated density)


## CHANGELOG:

1.0 -> 1.1
    Fix a bug with bandwidth calculation. Introduce the new "bw_adj"
    option. Switch to markdown for the help text.
    
0.9 -> 1.0
    Make the kernel smoothing a little faster. Introduce the new
    keyword "buffer" (conditional on a sufficiently recent gretl
    version). Fix (hopefully) the bug whereby the number of contours
    displayed may have been smaller than the one wanted.
    
0.3 -> 0.9
    Redesign the user interface quite radically, using an option
    bundle and scrapping a few public functions. Introduce the heatmap
    plot and the GUI hook. Fix a sort-of-bug that prevented the plot
    to be saved from the display interface.
    
0.2 -> 0.3
    Fix an issue with decimal point and modernise syntax a little
    while at it. No other user-visible changes.
