
16/04/2020
Initial implementation.

Version number 0.0-1.

17/04/2020
Tweaked mehse() (replaced "n" by "topn").
Tweaked mlehse(); added a "start" argument, defaulting
to the mehse() estimates; added an "sd" attribute to the
returned value.

Adjusted the help appropriately.

Incremented the version number to 0.0-2.

17/04/2020
Changed the title in DESCRIPTION to "title case".
Removed spurious/unnecessary keywords from the help
files.

Incremented the version number to 0.0-3.

18/04/2020
Adjusted mehse() and mlehse() so as to allow missing values
in the vector x of observations.

Adjusted dhse() so as to allow missing values amongst the entries
of the first argument "i".

Made appropriate modifications to the help files.

NOTE: phse() and qhse() needed no adjustment; they already handled
missing values amongst the entries of their first arguments ("x"
and "p" respectively).

Incremented the version number to 0.0-4.

22/04/2020
Added functions expValHse() and varHse() to calculate
the mean and variance of an hse distribution.

Incremented the version number to 0.0-5.

26/04/2020
Got rid of the dependence of mlehse() on MASS:fitdistr(), which seemed
to fuck things.  Instead implemented a roll-your-own call to optim().

Incremented the version number to 0.0-6.

27/04/2020
Added "zero origin" capability, to deal with distributions
on {0, 1, 2, ..., topn} rather than on {1, 2, ..., topn}.
The argument zeroOrigin defaults to FALSE.

Added an example in the help for mlehse() in which an hse
distribution is fitted to a sample from a binomial distribution
and the probabilities are compared graphically.

Incremented the version number to 0.0-7.

30/04/2020
Changed the argument lists of expValHse() and varHse() from
alpha, beta, ... to pars, ... (where pars is of course the
vector with entries alpha and beta).

Incremented the version number to 0.0-8.

30/04/2020
Gave the object returned by mlehse() the class "mlehse".
Gave this object attributes "topn" and "zeroOrigin".
Wrote a plot method plot.mlehse() to plot such objects.

Incremented the version number to 0.0-9.

18/05/2020
Changed the default value of "eps" in mlehse() from
sqrt(.Machine$double.eps) to 0.001.  (The former was overkill,
and I foresaw its causing trouble in the context of
hmmHse::hmm().)

Corrected a mild omission in the help for mlehse().  (It said
the data were between 1, and topn; will be between 0 and topn if
zeroOrigin is TRUE.)

02/10/2020 --- 18/10/2020
Added the function plotHse() to plot the hse probability
function given the appropriate parameters.

Adjusted plot.mlehse() to call upon plotHse() to do the heavy
lifting.

Wrote help for plotHse() and adjusted the help for plot.mlehse().

Changed the name "zeroOrigin" to "zeta" throughout all of the code
and the help files.

Incremented the version number to 0.0-10 (18/10/2020).

19/10/2020
Re-did the moment estimating function mehse() using my
new insight that the normalising constant is approximatel
n + 2, so that I no longer have to pretend that it is equal
to 1.  (Can't for the life of me figure out why this pretense
seemed to work reasoably well; it's utter nonsense!)

Changed the argument lists of expValHse() and varHse() to use
alpha and beta rather than "pars" (where pars[1] = alpha and
pars[2] = beta).

Incremented the version number to 0.0-11.

03/11/2020
Adjusted plot.mlehse() (now plot.mleHse()) to have xlim
and ylim arguments (defaulting to their old hard-wired values).

07/11/2020
Adjusted function names to use "saddleback" structure.  I.e.
changed the name of mlehse() to mleHse(), that of mehse() to
meHse() and plot.mlehse() to plot.mleHse().  The class of the
object returned by mleHse() is changed from "mlehse" to "mleHse".

Adjusted the help for mleHse() to point out the fact that the
object returned is of class "mleHse".

Incremented the version number to 0.0-12.

23/11/2020

Changed names of argument "topn" and variable "botn" to
"ntop" and "nbot" respectively.

Incremented the version number to 0.0-13.

28/11/2020

Adjusted help files, adding advice on the choice of "ntop"
according to whether the data have no theoretical upper bound,
a known theoretical upper bound, or neither (in which case
it is expedient to take "ntop" to be the maximum of the observed
data).  Based on advice from Russell Millar.

Augmented the examples for mleHse() to include data simulated from
a Poisson distribution (illustrating the setting in which the data
have no theoretical upper bound).

Added a "tikx" argument to plot.mleHse().

Incremented the version number to 0.0-14.

02/12/2020

Corrected a typo in hse.Rd ("zeroOrigin" should have been "zeta").
Spotted by Duncan Murdoch.

Adjusted dhse() so that it handles its "i" argument in a manner more
consistent with that of other "d" functions in R (e.g.  dbinom()).
Suggested by Duncan Murdoch.  Added a note to this effect in the
help file hse.Rd.

Augmented mleHse() so that it supplies (as attributes of the
returned value) the maximised log likelihood ("log.like"), the
estimated covariance matrix of the parameter estimates ("covMat")
and the number of data in the data set ("ndata").

Added a simulate.mleHse() method.

Made expValHse() and varHse() generic functions, with default
and "mleHse" methods.

Incremented the version number to 0.0-15.

03-05/12/2020

Added "utility" functions llPlot(), dfltHess(), hhHess()
and mcCovMat.

Changed dhse() to calculate its values "directly" rather
than calling upon dbeta().

Added function grad() and hess() to calculate the gradient
and hessian of the log likelihood analytically.  Modified
mleHse() to make use of these functions.

Modified mleHse() to append to the returned value attributes
"eps" (the value of the lower parameter bound that was used).
Changed the attribute "ndata" to be the number of *non-missing*
values in the data.  Changed the order of the arguments of
mleHse() slightly.  (Put "zeta" where it *should* be, right
after "ntop".)

Incremented the version number to 0.0-16.

06/12/2020

Added utilities vcov.mleHse(), logLik.mleHse() and ndata().

Incremented the version number to 0.0-17.

07/12/2020

Amended mleHse() to use method="BFGS" rather than "L-BFGS-B".
Imposing a lower bound on the parameters is no longer required.
Removed the "eps" argument.

Note that calculation of the hessian by analytic means is retained.
The call to optim() does not involve the "hessian" argument, so
that this argument is left equal to its default value of FALSE.
The analytic value of the hessian seems to agree almost exactly
(to within about +/- 5e-7 in a small test) so this doesn't really
matter, but it might (???) save a few nanoseconds of computing time!

Created a standalone function aHess() to compute the hessian
analytically from an "mleHse" object and the corresponding data set.
Just because I could. :-)

Removed the functions dfltHess(), hhHess() and mcCovmat() since they
are no longer needed (and the latter function --- mysteriously ---
does not work, anyway).  Removed the corresponding help files.

Change the default values of "alim" and "blim" in llPlot() to
be c(0,10), since we no longer have to shy away from 0.

Added example with negative parameters to the help for llPlot().
Added example with negative parameters to the help for plotHse().

Incremented the version number to 0.0-18.

08/12/2020

Put back the functions dftlHess() (renaming it to nHess() ---
numeric hessian) and mcCovmat().  The latter *does* work (!!!)
under the new regimen under which parameters are allowed to be
negative and constrained maximisation of the likelihood is not
required.  Adjusted the examples.  Also adjusted aHess() and
its help.

Incremented the version number to 0.0-19.

09/12/2020

Added the function finfo() (Fisher information), essentially the
same thing as aHess() execept that the parameters are specified
individually rather than being extracted from an "mleHse" object.

Amended hess() to use an argument "ndata", rather than "x".  The only
used made of "x" was to provide the value of "ndata".  Put the
"ndata" argument last in the argument list (whereas "x" was first).

Correspondingly addjusted the call to hfun() (the wrapper for hess())
in mleHse().

Incremented the version number to 0.0-20.

10/12/2020

Put in "correction factor" (ndata - 3)/ndata for the hessian
in aHess(), nHess() and finfo() and (the other way up) ndata/(ndata-3)
for the covariance matrix in mleHse().

The previous results produced a "lower bound" for the covariance
matrix.  The subtrahend 3 is mysterious.  Intuitively (???) it should
be 2, but that does not correct sufficiently, and in some experiments
3 seems to work.  Go figure.

Incremented the version number to 0.0-21.

11/12/2020

Put a lower bound of .Machine$double.eps^0.25 on "s2" in
meHse(), to prevent division by zero (which gives Inf values
for the estimates and optim() doesn't like these.

Put an upper bound of "UB", defaulting to 10, on the starting
values (when these are supplied by meHse()).  It seems that when
the starting values are too large (it is not clear *how* large)
optim() throws an error.

Incremented the version number to 0.0-22.

14/12/2020

Got rid of the stupid ndata/(ndata - 3) correction factor introduced
in version 0.0-21. It makes no sense whatever; my thinking was muddled,
the factor makes no sense whatever, and its apparent success in a
particular instance seems to have been just a matter of luck.

Replaced it by 1 + 16/ndata which was derived by fitting a linear
model to an appropriate data set generated via simulation.  This
new factor probably doesn't make much sense either.  It is invoked
only if the "adjust" argument of aHess(), nHess(), finfo() and
mleHse() is TRUE.  The default is FALSE.

Incremented the version number to 0.0-23.

15/12/2020

Added the function gof() to effect goodness of fit tests.

Incremented the version number to 0.0-24.

02/01/2021

Backed out the "adjust" argument from aHess(), nHess(), finfo()
and mleHse().  It's bullshit.

Incremented the version number to 0.0-25.

03/01/2021

Added a "seed" argument to mcCovMat() and gave the returned
value an attribute "seed".

Fixed several glitches in the help for mcCovMat() and mleHse().

Incremented the version number to 0.0-26.
