Learn R Programming

dbstats (version 1.0.4)

D2toG: Distance conversion: D2 to G

Description

Converts D2 class object into Gram class object.

Usage

D2toG(D2,weights)

Arguments

D2

D2 object. Squared distances matrix between individuals.

weights

an optional numeric vector of weights. By default all individuals have the same weight.

Value

An object of class Gram containing the Doubly centered inner product matrix of D2.

See Also

GtoD2 disttoD2 D2toDist

Examples

Run this code
# NOT RUN {
X <- matrix(rnorm(100*3),nrow=100)
D2 <- as.matrix(dist(X)^2)
class(D2) <- "D2"
G <- D2toG(D2,weights=NULL)

# }

Run the code above in your browser using DataLab