[R] svm plot question

Aimin Yan aiminy at iastate.edu
Thu Dec 7 22:42:04 CET 2006


I run the following code, all other is ok,
but plot(m.svm,p5.new,As~Cur) is not ok

Anyone know why?

install.packages("e1071")
library(e1071)
library(MASS)
p5 <- read.csv("http://www.public.iastate.edu/~aiminy/data/p_5_2.csv")
p5.new<-subset(p5,select=-Ms)
p5.new$Y<-factor(p5.new$Y)
levels(p5.new$Y) <- list(Out=c(1), In=c(0))
attach(p5.new)
m.svm<-svm(Y~P+Aa+As+Cur,data=p5.new)
summary(m.svm)
plot(m.svm,p5.new,As~Cur)

Here is output:

 > install.packages("e1071")
--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://rh-mirror.linux.iastate.edu/CRAN/bin/windows/contrib/2.4/e1071_1.5-16.zip'
Content type 'application/zip' length 592258 bytes
opened URL
downloaded 578Kb

package 'e1071' successfully unpacked and MD5 sums checked

The downloaded packages are in
         C:\Documents and Settings\aiminy\Local 
Settings\Temp\RtmpY0B2qb\downloaded_packages
updating HTML package descriptions
 > library(e1071)
Loading required package: class
 > library(MASS)
 > p5 <- read.csv("http://www.public.iastate.edu/~aiminy/data/p_5_2.csv")
 > p5.new<-subset(p5,select=-Ms)
 > p5.new$Y<-factor(p5.new$Y)
 > levels(p5.new$Y) <- list(Out=c(1), In=c(0))
 > attach(p5.new)
 > m.svm<-svm(Y~P+Aa+As+Cur,data=p5.new)
 > summary(m.svm)

Call:
svm(formula = Y ~ P + Aa + As + Cur, data = p5.new)


Parameters:
    SVM-Type:  C-classification
  SVM-Kernel:  radial
        cost:  1
       gamma:  0.04

Number of Support Vectors:  758

  ( 382 376 )


Number of Classes:  2

Levels:
  Out In



 > plot(m.svm,p5.new,As~Cur)
Error in scale(newdata[, object$scaled, drop = FALSE], center = 
object$x.scale$"scaled:center",  :
         (subscript) logical subscript too long
 >
 >




More information about the R-help mailing list