BiweightMidvariance[list]
gives the value of the biweight midvariance of the elements in list.
BiweightMidvariance[list,c]
gives the value of the biweight midvariance with scaling parameter c.
BiweightMidvariance
BiweightMidvariance[list]
gives the value of the biweight midvariance of the elements in list.
BiweightMidvariance[list,c]
gives the value of the biweight midvariance with scaling parameter c.
Details
- BiweightMidvariance is a robust dispersion estimator.
- BiweightMidvariance is given by a weighted second-order central moment with Median as its center. Elements farther from the center have lower weights.
- The width scale of the weight function is controlled by a parameter c. Larger c indicates more data values are included in the computation of the statistic, and vice versa.
- For the list {x1,x2,…,xn}, the value of the biweight midvariance estimator is given by
, where
,
is Median[{x1,x2,…,xn}], and
is MedianDeviation[{x1,x2,…,xn}]. - BiweightMidvariance[list] is equivalent to BiweightMidvariance[list,9].
- BiweightMidvariance[{{x1,y1,…},{x2,y2,…},…}] gives {BiweightMidvariance[{x1,x2,…}],BiweightMidvariance[{y1,y2,…}],…}.
- BiweightMidvariance allows c to be any positive real number.
Examples
open all close allBasic Examples (4)
BiweightMidvariance of a list:
BiweightMidvariance[{6.5, 3.8, 6.6, 5.7, 6.0, 6.4, 5.3}]BiweightMidvariance of columns of a matrix:
BiweightMidvariance[{{1., 2.}, {4., 8.}, {5., 3.}, {2., 15.}}]BiweightMidvariance of a list with scaling factor 8:
BiweightMidvariance[{1, 2, 3, 2, 1}, 8]BiweightMidvariance of a list of dates:
BiweightMidvariance[{Yesterday, Today, Tomorrow}]Scope (9)
Exact input yields exact output:
BiweightMidvariance[{1, 20, 3, 4}]Approximate input yields approximate output:
BiweightMidvariance[{1., 2., 3., 4.}]BiweightMidvariance[N[{1, 2, 3, 4}, 30]]Biweight midvariance with different scaling parameters:
BiweightMidvariance[{1.2, 3.8, 4.2, -0.5, -5.2}, 10]BiweightMidvariance[{1.2, 3.8, 4.2, -0.5, -5.2}, 100]Biweight midvariance for a matrix gives columnwise estimate:
BiweightMidvariance[RandomReal[1, {50, 3}]]Biweight midvariance of a large array:
BiweightMidvariance[RandomReal[1, 10 ^ 6]]BiweightMidvariance[RandomReal[1, {10 ^ 6, 3}]]Find a biweight midvariance of a TimeSeries:
ts = TemporalData[TimeSeries, {{{3, 8, 4, 11, 9, 2}}, {{{1, 3, 5, 7, 8, 10}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False,
10.1];BiweightMidvariance[ts]//NThe biweight midvariance depends only on the values:
BiweightMidvariance[ts["Values"]//N]Biweight midvariance works with data involving quantities:
data = Quantity[RandomReal[1, 6], "Meters"]BiweightMidvariance[data]Compute biweight midvariance of dates:
dates = WolframLanguageData[All, "DateIntroduced"];DateHistogram[dates]BiweightMidvariance[dates]UnitConvert[%, "Years" ^ 2]Compute biweight midvariance of times:
RandomTime[3]BiweightMidvariance[%]List of times with different time zone specifications:
{TimeObject[{12}, TimeZone -> 0], TimeObject[{12}, TimeZone -> 2], TimeObject[{12}, TimeZone -> "Asia/Tokyo"]}BiweightMidvariance[%]Applications (5)
Obtain a robust estimate of dispersion when extreme values are present:
BiweightMidvariance[{3, 10, 10 ^ 6, 20, 5, 6}]//NSample variance is heavily influenced by extreme values:
Variance[{3, 10, 10 ^ 6, 20, 5, 6}]//NIdentify periods of high volatility in stock data:
data = TemporalData[«4»];DateListPlot[data]Smooth the data using the square root of a five-year moving biweight midvariance:
smooth = Sqrt[MovingMap[BiweightMidvariance, data, {Quantity[5, "Year"]}]];DateListPlot[smooth]Compute biweight midvariance for slices of a collection of paths of a random process:
data = RandomFunction[WienerProcess[], {0, 1, .01}, 10 ^ 3];times = Range[0.1, 1, .1];md = Map[{#, BiweightMidvariance[data["SliceData", #]]}&, times]Plot biweight midvariances over these paths:
Show[ListPlot[data], ListLinePlot[md, PlotStyle -> Black]]Find the biweight midvariance of the heights for the children in a class:
heights = Quantity[{134, 143, 131, 140, 145, 136, 131, 136, 143, 136, 133, 145, 147,
150, 150, 146, 137, 143, 132, 142, 145, 136, 144, 135, 141}, "Centimeters"];ListPlot[heights, Filling -> Axis, AxesLabel -> Automatic]bmv = BiweightMidvariance[heights]//NPlot the square root of the biweight midvariance with respect to the median:
m = Median[heights];
n = Length[heights];
sbmv = Sqrt[bmv];ListPlot[{heights, {{0, m}, {n, m}}, {{0, m - sbmv}, {n, m - sbmv}}, {{0, m + sbmv}, {n, m + sbmv}}}, Filling -> {1 -> 0, 3 -> {4}}, Joined -> {False, True, True, True}, PlotStyle -> {Automatic, Automatic, Gray, Gray}, PlotLegends -> {"heights", "median", "bands"}, AxesLabel -> Automatic]Consider data from standard normal distribution with outliers modeled by another normal distribution with large spread:
BlockRandom[
SeedRandom[10];
data = RandomVariate[MixtureDistribution[{0.95, 0.05}, {NormalDistribution[], NormalDistribution[0, 10]}], 10 ^ 4];
]QuantilePlot[data]Test the data against standard normal distribution:
DistributionFitTest[data, NormalDistribution[], "TestConclusion"]Compute the biweight midvariance:
bmv = BiweightMidvariance[data]Remove outliers by picking data points that are within three times the square root of biweight midvariance from the sample median:
bound = 3Sqrt[bmv];
med = Median[data];ndata = Pick[data, Sign[Abs[data - med] - bound], -1];QuantilePlot[ndata]Test the new data against standard normal distribution:
DistributionFitTest[ndata, NormalDistribution[], "TestConclusion"]Properties & Relations (3)
Compute the biweight midvariance of a sample:
data = {-1000, 3, 10, 20, 1, -3, 5, 0, 6, 1000};bw1 = N@BiweightMidvariance[data]Values outside of the interval
have no effect on the statistic. Here
is the sample median and
is the median absolute deviation.
is a scaling parameter with default value equal to 9:
{x0, δ} = {Median[data], MedianDeviation[data]}The shape of the weight function w(x) being used in computing biweight midvariance:
Plot[Max[1 - ((x - x0) / (9 δ)) ^ 2, 0] ^ 2, {x, -60, 70}]Multiply the smallest and the largest values in the sample by 2 and compute the biweight midvariance again:
data[[{1, -1}]] *= 2;bw2 = N@BiweightMidvariance[data]bw1 == bw2BiweightMidvariance and Variance are dispersion estimators of data:
data = RandomVariate[StudentTDistribution[2], 10 ^ 4];
est = {BiweightMidvariance, Variance};TableForm[Through[est[data]], TableHeadings -> {est}]Resample the data to generate bootstrap estimates:
{bmvbootstrap, varbootstrap} = Transpose[Table[Through[est[RandomChoice[data, 10 ^ 4]]], {10 ^ 3}]];Compute the standard deviation/mean ratio of the bootstrap estimates for each estimator; smaller value indicates more accurate dispersion measure:
StandardDeviation[bmvbootstrap] / Mean[bmvbootstrap]StandardDeviation[varbootstrap] / Mean[varbootstrap]BiweightMidvariance converges to the second central moment for large values of the parameter c:
data = RandomReal[StudentTDistribution[1], 1000];cm = CentralMoment[data, 2]Plot[{BiweightMidvariance[data, c], cm}, {c, 5, 10 ^ 4}, AxesLabel -> {c}, PlotRange -> All, PlotLegends -> {"biweight mid-variance", "second central moment"}]Possible Issues (1)
Biweight midvariance may be undefined for vectors of an even number of elements with a small scaling parameter:
data1 = {1., 2., 3., 4.};BiweightMidvariance[data1, 0.5]For vectors of odd length and relatively small c, biweight midvariance might assume very large values:
data2 = {1., 2., 3., 4., 5.};Plot[BiweightMidvariance[data2, c], {c, 1, 2}, PlotRange -> All]BiweightMidvariance[data2, 1.678245]Related Guides
Text
Wolfram Research (2017), BiweightMidvariance, Wolfram Language function, https://reference.wolfram.com/language/ref/BiweightMidvariance.html (updated 2024).
CMS
Wolfram Language. 2017. "BiweightMidvariance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/BiweightMidvariance.html.
APA
Wolfram Language. (2017). BiweightMidvariance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BiweightMidvariance.html
BibTeX
@misc{reference.wolfram_2026_biweightmidvariance, author="Wolfram Research", title="{BiweightMidvariance}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/BiweightMidvariance.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_biweightmidvariance, organization={Wolfram Research}, title={BiweightMidvariance}, year={2024}, url={https://reference.wolfram.com/language/ref/BiweightMidvariance.html}, note=[Accessed: 13-June-2026]}