[R] R2
Max Kuhn
mxkuhn at gmail.com
Tue Dec 29 13:32:31 CET 2009
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 <nancyadam84 at 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 at 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.
More information about the R-help
mailing list