Displaying 1 result from an estimated 1 matches for "wtpercentil".
Did you mean:
wtpercentile
2009 Feb 17
6
Percentiles/Quantiles with Weighting
...tions - so if anyone has any suggestions
on how to look at quantiles/percentiles within R while also using a
weighting schema, I would be very interested.
Note - this function supposes the data in X is time-sequenced, with the most
recent (and thus heaviest weighted) data at the end of the vector
WtPercentile <- function(X=rnorm(100), pctile=seq(.1,1,.1))
{
Xprime <- NA
for(i in 1:length(X))
{
Xprime <- c(Xprime, rep(X[i], times=i))
}
print("Percentiles:")
print(quantile(X, pctile))
print("Weighted:")
print(Xprime)
print("Weighted Percentiles:&q...