Edge Rewrite
// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a25370aafaab4c41

Jump to content

Talk:Retention uniformity

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 16 years ago by RJFJR in topic Calculation

Calculation

[edit]

Doesn't seem to add much to the article so moved to talk. RJFJR (talk) 14:25, 28 June 2010 (UTC)Reply

The calculation of the RU requires some operations and is quite difficult to perform in spreadsheets. The following implementations may help. They take the vector of Rf values, returning the single RU value.

The R (programming language)/S-PLUS implementation:

ru <- function (x) 
{
        x <- sort(x)
        n <- length(x)
        i <- (1:n)/(n+1)
        s <- sum((x-i)^2)
        ru <- 1-sqrt( (6*(n+1)) / (n*(2*n+1)) * s );
        return(ru);

}

The GNU Octave/Matlab implementation:

function res = ru(x)
	x = sort(x);
	n = length(x);
	i = (1:n)./(n+1);
        s = sum((x-i).^2);
        res = 1-sqrt((6.*(n+1))./(n.*(2.*n+1)).*s);
endfunction

The Scilab implementation:

function res = ru(x)
	x = gsort(x,"g","i");
	n = length(x);
	i = (1:n)./(n+1);
        s = sum((x-i).^2);
        res = 1-sqrt((6.*(n+1))./(n.*(2.*n+1)).*s);
endfunction