qBCI: Quantile BCI

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/qBCI.R

Description

Bins numeric variables according to their quantiles and computes the Bertin Classification Index BCI. The data.frame method computes the multivariate qBCI and not the pairwise values (c.f. cmat).

Usage

1
2
3
4
5
qBCI(x, ...)
## Default S3 method:
qBCI(x, y, p = NULL, k = 5, iter=20, ...)
## S3 method for class 'data.frame'
qBCI(x,p = NULL, k = 5, sort = TRUE, iter=20, ...)

Arguments

x

A numeric vector (in this case y needs to be specified) or a data.frame with numeric or factor variables.

y

A numeric vector.

p

A percentage to use for the quantiles sequence. See details.

k

A minimum expected number of observations in each cell after the binning.

sort

Whether or not to compute the BCI for the optimized tables or not. If not, kendalls is usually a better alternative.

iter

An optile parameter.

...

dots

Details

The breakpoints for the binning are the data quantiles according to equidistant probabilities seq(0,1,p) where p is minimal under the condition that each cell has an expected number of observations of at least k.

Value

A value between 0 and 1.

Author(s)

Alexander Pilhoefer

See Also

BCI,kendalls, wdcor, cmat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Not run: 
qBCI(rnorm(100),runif(100))


# non-functional relationship:
x1 <- runif(500,0,10)
x2 <- runif(500,0,10)
y1 <- x1+rnorm(500,sd=1) 
y2 <- 10-x2+rnorm(500,sd=1) 

x <- c(x1,x2)
y <- c(y1,y2)

plot(x,y, pch = 19)

wdcor(x,y)
1 - qBCI(x,y)


y1 <- x1+rnorm(500,sd=0.1) 
y2 <- 10-x2+rnorm(500,sd=0.1) 

x <- c(x1,x2)
y <- c(y1,y2)

plot(x,y, pch = 19)

wdcor(x,y)
1 - qBCI(x,y)

# or a quadratic curve:
test <- sapply(seq(0,4,0.2),function(s){
x <- runif(200,-1,1)
y <- 5+12*x^2+rnorm(200,sd=s)
return(c(cor(x,y),
wdcor(x,y),
1 - qBCI(x,y)))
})


plot(test[3,],type="l", ylim=c(-0.2,1))
lines(test[1,], col = 2, lwd = 2)

lines(test[2,], col = 3, lwd = 2)


## End(Not run)

extracat documentation built on July 17, 2018, 5:05 p.m.

Related to qBCI in extracat...