# WeightedData

WeightedData[{x1,x2,},{w1,w2,}]

represents observations xi with weights wi.

WeightedData[{x1,x2,},fn]

represents observations xi with weighting function fn.

# Details

• WeightedData augments data with weights for each data point.
• The data {x1,x2,} and weights {w1,w2,} should be lists of equal length.
• The weight function fn is applied to the list {x1,x2,} and should return an explicit list of weights {w1,w2,}.
• WeightedData can be used in statistics functions including:
•  Mean,Variance,… descriptive statistics functions EmpiricalDistribution,… nonparametric distribution estimation EstimatedDistribution,… parametric distribution estimation
• WeightedData[{x1,x2,}] gives data with equal weights.
• Properties of WeightedData can be obtained by specifying WeightedData[]["property"].
• A list of available properties can be obtained using WeightedData[]["Properties"].
• WeightedData has the following properties:
•  "EmpiricalPDF" data values and estimated weights "InputData" unweighted input data values "MetaInformation" a list containing meta-information rules "Weights" a list containing the data weights

# Examples

open allclose all

## Basic Examples(1)

Create data with weights:

Compute a weighted Mean and StandardDeviation:

## Scope(10)

Create weighted univariate data:

Some weighted descriptive statistics:

Add weights to a set of multivariate values:

A set of weighted multivariate descriptive statistics:

Use a pure function to create weighted data values:

Weighted means and variances:

Visualize the impact of the various weighting schemes:

Fit nonparametric distributions to weighted data:

Fit parametric distributions to weighted data:

Compare the estimated and empirical distributions:

Extract the input data from a WeightedData object:

Compare the distributions of the unweighted and weighted data:

Obtain the weights from a WeightedData object:

Visually inspect the effect of the weights on the data values:

Compute a weighted mean from the empirical PDF:

The weighted mean can be computed directly using Mean:

Find the weighted average of an irregularly sampled TimeSeries:

Compare with the average of values:

Create weighted data involving quantities:

Some weighted descriptive statistics:

## Applications(2)

Create a weighted histogram:

Estimate confidence interval for maximum likelihood estimates of distribution parameters:

Apply fractional random weight bootstrap to estimate confidence interval, by repeating weighted estimation with weights sampled from a DirichletDistribution with unit parameters:

Generate one thousand estimates of the distribution parameters:

Visualize bootstrap estimates:

Fit joint Gaussian distribution to the bootstrapped parameters:

## Properties & Relations(2)

Descriptive statistics are based on the underlying EmpiricalDistribution:

Sample estimates are given when they differ from population estimates:

WeightedData works for TimeSeries objects:

For , the weights are proportional to :

Compare with binsampled time average:

Compute integration limits:

Wolfram Research (2012), WeightedData, Wolfram Language function, https://reference.wolfram.com/language/ref/WeightedData.html.

#### Text

Wolfram Research (2012), WeightedData, Wolfram Language function, https://reference.wolfram.com/language/ref/WeightedData.html.

#### CMS

Wolfram Language. 2012. "WeightedData." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WeightedData.html.

#### APA

Wolfram Language. (2012). WeightedData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WeightedData.html

#### BibTeX

@misc{reference.wolfram_2024_weighteddata, author="Wolfram Research", title="{WeightedData}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/WeightedData.html}", note=[Accessed: 16-September-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_weighteddata, organization={Wolfram Research}, title={WeightedData}, year={2012}, url={https://reference.wolfram.com/language/ref/WeightedData.html}, note=[Accessed: 16-September-2024 ]}