[R] R2

Gabor Grothendieck ggrothendieck at gmail.com
Tue Dec 29 16:54:18 CET 2009


** works as exponentiation for me:

> 3**2
[1] 9


On Tue, Dec 29, 2009 at 6:10 AM, Phil Spector <spector at stat.berkeley.edu> wrote:
> Nancy -
>   Please notice that ** is not an R operator. The caret (^) is the
> exponentiation operator in R.
>                                      - Phil
>
>
>
> On Tue, 29 Dec 2009, Nancy Adam 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.
>>
>
> ______________________________________________
> 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