summary.kproto | R Documentation |
Investigation of variances to specify lambda for k-prototypes clustering.
## S3 method for class 'kproto'
summary(object, data = NULL, pct.dig = 3, ...)
object |
Object of class |
data |
Optional data set to be analyzed. If |
pct.dig |
Number of digits for rounding percentages of factor variables. |
... |
Further arguments to be passed to internal call of |
For numeric variables statistics are computed for each clusters using summary()
.
For categorical variables distribution percentages are computed.
List where each element corresponds to one variable. Each row of any element corresponds to one cluster.
# generate toy data with factors and numerics
n <- 100
prb <- 0.9
muk <- 1.5
clusid <- rep(1:4, each = n)
x1 <- sample(c("A","B"), 2*n, replace = TRUE, prob = c(prb, 1-prb))
x1 <- c(x1, sample(c("A","B"), 2*n, replace = TRUE, prob = c(1-prb, prb)))
x1 <- as.factor(x1)
x2 <- sample(c("A","B"), 2*n, replace = TRUE, prob = c(prb, 1-prb))
x2 <- c(x2, sample(c("A","B"), 2*n, replace = TRUE, prob = c(1-prb, prb)))
x2 <- as.factor(x2)
x3 <- c(rnorm(n, mean = -muk), rnorm(n, mean = muk), rnorm(n, mean = -muk), rnorm(n, mean = muk))
x4 <- c(rnorm(n, mean = -muk), rnorm(n, mean = muk), rnorm(n, mean = -muk), rnorm(n, mean = muk))
x <- data.frame(x1,x2,x3,x4)
res <- kproto(x, 4)
summary(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.