a numeric value of the mode of the input distribution.
Arguments
x
is a numeric vector containing the values of the distribution.
xlim
is a vector with two entries.The first entry is the minimum of
the x distribution and the second entry is the maximum value of the
x distribution. Ideally these values should be the minimum and
maximum value of the prior for this particular parameter.
weights
this is an optional input consisting of a vector with the
prior weights for the locfit function.
alpha
numeric value with the alpha parameter of the locfit function.
The default value is 0.7
precision
value indicating the number of entries evaluated. The larger
the value the higher the precision. The default value is 1000.
Details
The locfit::locfit() function is used to fit a local regression to the
distribution. The stats::predict() function is then used to predict the
y-axis values of the locfit and the mode is defined as the value where that
prediction is maximized. Note that if this function is not able to fit a
local regression to the distribution, then the mode of the distribution will
be assumed to be equal to the median.