Learn R Programming

IntervalQuestionStat (version 0.2.0)

distance: Calculate the \(\theta\)-distance between two intervals

Description

This function calculates the \(\theta\)-distance between any two nonempty compact real intervals.

Usage

# S4 method for IntervalData,IntervalData
distance(e1, e2, theta = 1)

Value

This function returns the calculated \(\theta\)-distance between the two given intervals, which is defined as a single real number. Therefore, the output of this function is a single numeric value.

Arguments

e1

A single interval stored as an IntervalData object.

e2

A single interval stored as an IntervalData object.

theta

A single positive real number stored as a unique numeric value which is used for distance computations. By default, theta = 1.

Author

José García-García garciagarjose@uniovi.es

Details

The \(\theta\)-distance between any two given nonempty compact real intervals, \(A\) and \(B\), was defined by Gil et al. (2002) as the non-negative real number calculated as follows, $$d_{\theta}(A,B) = \sqrt{(\mathrm{mid}~A - \mathrm{mid}~B)^2 + \theta\cdot(\mathrm{spr}~A -\mathrm{spr}~B)^2},$$ where \(\theta\) is a positive real number.

References

Gil, M.Á.; Lubiano, M.A.; Montenegro, M.; López, M.T. (2002). Least squares fitting of an affine function and strength of association for interval-valued data. Metrika, 56:97-111. tools:::Rd_expr_doi("10.1007/s001840100160").

Examples

Run this code
## Some distance() examples
i1 <- IntervalData(0, 1)
i2 <- IntervalData(3, 7)
distance(i1, i2)      ## rho2 distance
distance(i1, i2, 1/3) ## Bertoluzza's distance with Lebesgue measure

Run the code above in your browser using DataLab