mode_locfit {poolABC}R Documentation

Compute mode of a locfit object

Description

This function computes and outputs the the mode of a locfit object.

Usage

mode_locfit(locx, xlim, precision = 1000)

Arguments

locx

is a locfit object.

xlim

is a vector with two entries.The first entry is the minimum of the distribution and the second entry is the maximum value of the distribution.

precision

value indicating the number of entries evaluated. The larger the value the higher the precision. The default value is 1000.

Details

The stats::predict() function is used to predict the y-axis values of the locfit object and the mode is defined as the value where that prediction is maximized.

Value

a numeric value of the mode of the input locfit object.

Examples

# create a random distribution
x <- rnorm(n = 1000, mean = 2, sd = 25)

# perform a local regression
loc <- locfit::locfit(~x)

# compute the mode of the locfit object
mode_locfit(locx = loc, xlim = c(min(x), max(x)))


[Package poolABC version 1.0.0 Index]