search for: gini_mean_difference

Displaying 1 result from an estimated 1 matches for "gini_mean_difference".

2003 Apr 24
5
Fast R implementation of Gini mean difference
I have written the following function to calculate the weighted mean difference for univariate data (see http://www.xycoon.com/gini_mean_difference.htm for a related formula). Unsurprisingly, the function is slow (compared to sd or mad) for long vectors. I wonder if there's a way to make the function faster, short of creating an external C function. Thanks very much for your advice. gmd <- function(x, w) { # x=data vector, w=weights...