SASquantile {STB}R Documentation

Implements SAS-quantile Calculation (PCTLDEF=5) as Described by SAS-Help.

Description

This implementation seems to be identical with 'type=2' in function quantile but less efficiently implemented, i.e. for large vectors x it is much slower than the built-in quantile-function.

Usage

SASquantile(x, prob, tol = 1e-12, type = c("R", "C"))

Arguments

x

(numeric) vector

prob

(numeric) value 0 < prob < 1

tol

(numeric) value used for checking numerical equivalence

type

(character) "R" = uses the R-implementation, "C" = calls the C-implementation n

Author(s)

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

Examples

## Not run: 
SASquantile(1:100, .75)

### compare to R-default
quantile(1:100, .75) 

### or to what R calls SAS-definition
quantile(1:100, .75, type=3)

# should work for any vector (no seed)
v <- rnorm(50000,20,7)
Q.R2    <- quantile(v, probs=c(.01, .025, .05, .1, .25, .5, .75, .9, .95, .975, .99), type=2)
Q.SAS.R <- SASquantile(v, prob=c(.01, .025, .05, .1, .25, .5, .75, .9, .95, .975, .99), type="R")
Q.SAS.C <- SASquantile(v, prob=c(.01, .025, .05, .1, .25, .5, .75, .9, .95, .975, .99), type="C")

Q.R2
Q.SAS.R
Q.SAS.C

## End(Not run)

[Package STB version 0.6.5 Index]