predict.kmeans_ClustImpute {ClustImpute} | R Documentation |
Prediction method
Description
Prediction method
Usage
## S3 method for class 'kmeans_ClustImpute'
predict(object, newdata, ...)
Arguments
object |
Object of class kmeans_ClustImpute |
newdata |
Data frame |
... |
additional arguments affecting the predictions produced - not currently used |
Value
integer value (cluster assignment)
Examples
# 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)
predict(res,newdata=dat[1,])
[Package ClustImpute version 0.2.4 Index]