Description Usage Arguments Value Examples
Prediction method
1 2 |
object |
Object of class kmeans_ClustImpute |
newdata |
Data frame |
... |
additional arguments affecting the predictions produced - not currently used |
integer value (cluster assignment)
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)
predict(res,newdata=dat[1,])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.