Nancy,
There is a function in the caret package called defaultSummary that
will compute both RMSE and R2 for you.
Max
On Dec 28, 2009, at 11:51 PM, Nancy Adam <nancyada...@hotmail.com>
wrote:
Hi everyone,
I tried to write the code of computing R2 for a regression system
but I failed.
This is the code I use for computing RMSE:
my_svm_model <- function(myformula, mydata, mytestdata)
{
mymodel <- svm(myformula, data=mydata)
mytest <- predict(mymodel, mytestdata)
error <- mytest - mytestdata[,1]
-sqrt(mean(error**2))
}
can anyone please tell me what I have to change to compute R2
instead of RMSE?
Many thanks,
Nancy
_________________________________________________________________
[[alternative HTML version deleted]]
______________________________________________
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.
______________________________________________
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.