On 24/11/2017 6:27 AM, PIKAL Petr wrote:
Dear all

Strictly speaking it is not R question but as you are the most capable persons 
I know I give it a try.

I am strugling with recalculation of number weighted to volume weighted 
distribution.

Suppose I have objects (cubes) with size

x<- c(rep(10,20), rep(100, 10), rep(300,5))
I can get

plot(ecdf(x))

or the number weighted average

mean(x)
[1] 77.14286

or volume weighted average
weighted.mean(x, (x/sum(x^3)))
[1] 204.4444

However I am struggling with volume weighted ecdf.

Can you please give me some hints?

I believe base R doesn't have a function for this, but Google says it exists in a couple of packages: spatstat, Hmisc. But you seem to be asking about a definition rather than a function: it is obtained simply by normalizing the weights to sum to 1, then evaluating cumulative sums of them.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to