median.BData: A distributional median

View source: R/statistics.R

median.BDataR Documentation

A distributional median

Description

The distributional median is the distribution (from a dataset), that minimizes the sum over the Bayes Space distances in the dataset. The sample median selects the distribution from the dataset that minimizes this distance (or maximizes the spatial depth).

Usage

## S3 method for class 'BData'
median(x, na.rm = TRUE, ..., distType = c("meandistance", "spatialdepth"))

Arguments

x

a BData object

na.rm

if true missing distances will be set to the maximum distance

...

further parameters to dist

distType

"meandistance" for mean distance to datapoints, "spatialdepth" for the spatial depth.

Value

An object of the same type as x, but with only the median, defined as the value with the smallest distance to all others (distType "mean"), or the largest spatial depth (distType "spatialdepth").

See Also

Other caseStatistics: caseE(), caseLogRatios(), caseMeans(), caseQuantiles(), caseSds(), caseVars(), centralityQuantile(), distanceToCenter(), spatialDepth()

Examples

data(DTD)
Xpdf    = BDataPDFs(DTD$shapePDF,basis=B2Unif01Basis5)
median(Xpdf)


DistributionalDDA documentation built on Oct. 20, 2026, 5:06 p.m.