Dear R-Users,

i want to use the function svm of the e1071 package to predict missing data

############################################################

data(iris)

## create missing completely at random data
for (i in 1:5)
{
 mcar <- rbinom(dim(iris)[1], size=1, prob=0.1)
 iris[mcar == 1, i] <- NA
}

ok <- complete.cases(iris)

model <- svm(Species ~ ., data=iris[ok,])

## try to predict the missing values for Species
## neither
pred <- predict(model, iris[5])
## nor
pred <- predict(model, iris[!ok, -5])
## seems to work....

Many thanks if anyone could tell me what i do wrong and what is the problem here.

best regards

Andreas

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to