Hi Nancy,
On Wed, Dec 30, 2009 at 12:08 PM, Nancy Adam <nancyada...@hotmail.com> wrote: > Hi everyone, > Thanks a lot for the explanation… > > I tried the following code to compute R2 for a regression system but it does > not work: > > my_svm_model <- function(myformula, mydata, mytestdata) > { > mymodel <- svm(myformula, data=mydata) > k<- summary(mymodel) > k$r.squared > } > > Can anyone please tell me what I have to change to compute R2? Out of curiosity, what makes you think you'll find "r.squared" in your "k" object? Did you see that in the help somewhere? Anyway, given that you've already shown that you know how to calculate RMSE of a regression model, it should be pretty straightforward to rig up the formulas found on the wikipedia page to get R^2: http://en.wikipedia.org/wiki/Coefficient_of_determination -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact ______________________________________________ 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.