[R] Squared correlation error
Max Kuhn
mxkuhn at gmail.com
Wed Dec 30 19:59:28 CET 2009
There is a function called defaultSummay in the caret package that
will compute r-squared and rmse.
Max
On Dec 30, 2009, at 1:30 PM, Steve Lianoglou <mailinglist.honeypot at gmail.com
> wrote:
> Hi Nancy,
>
>
> On Wed, Dec 30, 2009 at 12:08 PM, Nancy Adam
> <nancyadam84 at 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 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