partition.crit: Combines the results of appplying an index to each group of...

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

View source: R/colpairs.R

Description

Applies the function gfun to each group of x and y values and combines the results using the function cfun

Usage

1
partition.crit(x, y, groups, gfun = gave, cfun = sum, ...)

Arguments

x

is a numeric vector.

y

is a numeric vector.

groups

is a vector of group memberships.

gfun

is applied to the x and y data in each group.

cfun

combines the values returned by gfun.

...

arguements are passed to gfun.

Details

The function gfun is applied to each group of x and y values. The function cfun is applied to the vector or matrix of gfun results.

Value

The result of applying cfun.

Author(s)

Catherine B. Hurley

References

See Gordon, A. D. (1999). Classification. Second Edition. London: Chapman and Hall / CRC

See Also

gave, colpairs, order.single

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
x <- runif(20)
y <- runif(20)
g <- rep(c("a","b"),10)

partition.crit(x,y,g)


data(bank)
# m is a homogeneity measure of each pairwise variable plot
m <- -colpairs(scale(bank[,-1]), partition.crit,gfun=gave,groups=bank[,1])

# Color panels by level of m and reorder variables so that
# pairs with high m are near the diagonal. Panels shown
# in pink have the highest amount of group homogeneity, as measured by 
# gave.
cpairs(bank[,-1],order=order.single(m), panel.colors=dmat.color(m),
gap=.3,col=c("purple","black")[bank[,"Status"]+1],
pch=c(5,3)[bank[,"Status"]+1])

# Try  a different measure
m <- -colpairs(scale(bank[,-1]), partition.crit,gfun=diameter,groups=bank[,1])

cpairs(bank[,-1],order=order.single(m), panel.colors=dmat.color(m),
gap=.3,col=c("purple","black")[bank[,"Status"]+1],
pch=c(5,3)[bank[,"Status"]+1])


# Result is the same, in this case.

gclus documentation built on May 2, 2019, 5:08 a.m.