var_reduction: Reduction of variance

Description Usage Arguments Value Examples

View source: R/ClustImpute.R

Description

Computes one minus the ratio of the sum of all within cluster variances by the overall variance

Usage

1
var_reduction(clusterObj)

Arguments

clusterObj

Object of class kmeans_ClustImpute

Value

integer value typically between 0 and 1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Random Dataset
set.seed(739)
n <- 750 # numer of points
nr_other_vars <- 2
mat <- matrix(rnorm(nr_other_vars*n),n,nr_other_vars)
me<-4 # mean
x <- c(rnorm(n/3,me/2,1),rnorm(2*n/3,-me/2,1))
y <- c(rnorm(n/3,0,1),rnorm(n/3,me,1),rnorm(n/3,-me,1))
dat <- cbind(mat,x,y)
dat<- as.data.frame(scale(dat)) # scaling

# Create NAs
dat_with_miss <- miss_sim(dat,p=.1,seed_nr=120)

res <- ClustImpute(dat_with_miss,nr_cluster=3)
var_reduction(res)

ClustImpute documentation built on May 31, 2021, 9:06 a.m.