# [ncl-talk] CALCULATE r2

Dennis Shea shea at ucar.edu
Thu Feb 18 20:17:21 MST 2016

```https://en.wikipedia.org/wiki/Coefficient_of_determination

===

http://www.ncl.ucar.edu/Document/Functions/Contributed/regline_stats.shtml

see the example

[SNIP]

; *ANOVA* information: SS=>Sum
of Squares
SST :	4823324                         ; Total SS:      sum((Y-Yavg)^2)
SSE :	50871.91                        ; Residual SS:   sum((Yest-Y)^2)
SSR :	4772452                         ; sum((Yest-Yavg)^2)

[SNIP
r2 :	0.989453                        ; square of the Pearson
correlation coefficient
r :	0.9947125                       ; multiple (overall) correlation: sqrt(r2)
r2a :	0.9887938                       ; adjusted r2... better for small

[SNIP]

See the Wikipedia article

r2 = 1 - (SSE/SST)
r2 = 1 - (50871.91/4823324.0)
r2 = 0.989453

On Thu, Feb 18, 2016 at 6:37 PM, mark vogel <mdvogelii at gmail.com> wrote:

> Do you have a ncl code to calculate R2 value instead of express
> correlation with rc?
> I try to follow Dennis shea talk in ncl forum but I got multiple variance
> values coming out not only one value.
> https://www.ncl.ucar.edu/Support/talk_archives/2009/2202.html
> Thanks
> Jam
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160218/788efb17/attachment.html
```