diff_multidim {CPC}R Documentation

Multidimensional Difference-in-Means

Description

Calculates average Euclidean distance between means in arbitrary dimensions.

Usage

diff_multidim(data, cols, clusters)

Arguments

data

a numeric vector or n x k matrix or data frame containing a vector identifying cluster membership for each observation, to be passed to clusters argument.

cols

columns of data to be used in difference-in-means calculation.

clusters

column of data indicating cluster membership for each observation.

Value

Returns a numeric vector of length 1.

Examples

data <- matrix(c(rnorm(50, 0, 1), rnorm(50, 5, 1)), ncol = 2, byrow = TRUE)
clusters <- matrix(c(rep(1, 25), rep(2, 25)), ncol = 1)
data <- cbind(data, clusters)

diff_multidim(data, 1:2, 3)


[Package CPC version 2.6.0 Index]