Re: [R] Fwd: Percentiles/Quantiles with Weighting

2009-02-17 Thread Dieter Menne
Stavros Macrakis alum.mit.edu> writes: > > Some minor improvements and corrections below > > # Simple weighted quantile > # > # v A vector of sortable observations > # w A numeric vector of positive weights > # p The quantile 0<=p<=1 > # > # Nothing fancy: no interpolation etc.; NA cases not

[R] Fwd: Percentiles/Quantiles with Weighting

2009-02-17 Thread Stavros Macrakis
Some minor improvements and corrections below # Simple weighted quantile # # v A vector of sortable observations # w A numeric vector of positive weights # p The quantile 0<=p<=1 # # Nothing fancy: no interpolation etc.; NA cases not thought through wquantile <- function(v,w=rep(1,length(v)),p