How to add weight to data in descriptive statistics? I have a class with a set of descriptive statistic functions (mean, median, kurtosis, etc...).
Now I need to include weight (array) into my equations. My first thought was to just create a weighted version of the functions where the additional weight array is passed.
However, I was wondering if there is a way to alter the data (array) so that the same functions can be used.
Question:
Is there a way to weight the data before calculating the descriptive statistics - so that the existing functions can be used.
If this is possible then I could add an additional function to weight the data before it is passed into the descriptive functions.
 A: Weights can arise in data analysis through various mechanisms, each of which requires its own formulas:


*

*A dataset with many duplicate results can be summarized by listing each unique result together with its frequency of occurrence.  This is the definition @drknexus assumes in order to provide a definite answer (after recognizing that other definitions are possible).

*When datasets represent averages or other statistics, their values have known (or at least pre-estimated) levels of uncertainty.  The weights can represent those levels.  (Typically the appropriate weight to use is the inverse of the variance.)  These are incorporated in methods like weighted least squares regression.

*Many datasets obtained through observational studies in the social and biological sciences arise from complex sampling schemes in which units/subjects have differing chances of being selected.  The appropriate weights to use in estimates are usually the inverses of the selection probabilities, as in the Hansen-Hurwitz Estimator and the Horvitz-Thompson Estimator.

*Various robust methods, such as IRLS regression, iteratively reweight data in order to de-emphasize atypical values.  These weights can enter into formulas in ways that differ from (1) - (3) above.
Thus, you need first to decide what your weights mean and what the purpose of computing the weighted statistics might be.
A: It isn't entirely clear from your question what sort of 'weight' you are talking about.  But I imagine it is a simple matter of wanting to count certain observations more than than others... 
If you wanted to, and your weights were integer values (or you can find the lowest common denominator to multiply by that will give you integer values), you could simply expand your data out to match the weights.  That is, a data point with a weight of 2 could be represented twice in your data array.  This is fine for descriptives such as mean, median, kurtosis, and skew.  However, it may be be problematic for calculations such as a sample estimate of the standard deviation where N matters and the difference between a raw N-1 and a N-1 where N is representative of the restructured array might be meaningful.
The only shortcut I can think of that might apply is to multiply your array by the weights and then analyze those results.  For the mean, to renormalize the value, you will need to divide the result by (sum)Weights/N_original.
However, for the median, kurtosis, and skew you won't be able to (readily) use this technique and I think you will have to revert to altering your function to produce new data arrays.
Good luck.
