[ncl-talk] Correlation in regline_stats

Dennis Shea shea at ucar.edu
Wed Apr 14 11:15:03 MDT 2021


Hi Jonathan,

Sorry for the delay. I did not see this. I guess I was
asleep-at-the-wheel.

Example 3 of the *regline_stats *
<http://www.ncl.ucar.edu/Document/Functions/Contributed/regline_stats.shtml>
Shows NCL results compared with the *R *results. They match.  :-)
---

To be honest, I can not remember the details of this function.

       r2   = SSR/SST              ; r2 = *coefficient of determination*
<https://en.wikipedia.org/wiki/Coefficient_of_determination>.

>From Wikipedia:  r2 "the *coefficient of determination*, denoted *R*2 ... is
the proportion of the variance in the dependent variable that is
predictable from the independent variable(s)."

"proportion" is a value from 0-to-1

Why, the following?
r    = sqrt(r2)             ; *multiple (overall) correlation*

Sorry, I just can not remember .... but ... it agrees with R.
This is a terrible answer, I just don't remember the details of why I did
what I did!

I can pursue this further if you wish.

Regards
D

On Mon, Apr 12, 2021 at 9:51 AM Buzan, Jonathan via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi NCL-Talk,
>
> I was producing figures using regline_stats and noticed that when I had
> negative regression coefficients I had a positive correlation R value.
> I am reading through the code for regline_stats routine and noticed that
> the r is calculated from r2, rather than the other way around.
>
>        r2   = SSR/SST              ; r2 = coefficient of determination. It
> is
>                                    ;      the square of the Pearson
> correlation
>                                    ;      coefficient between the observed
>                                    ;      and modeled (predicted) data
> values
>                                    ;      of the dependent variable. It is
>                                    ;      another measure of 'goodness of
> fit.'
>                                    ; biased high, particularly for small N
>
>        r2a  = r2-(1-r2)*NP/tofloat(dof)   ; adjusted r2... better for
> small N
>        r    = sqrt(r2)             ; multiple (overall) correlation
>
> So the R that is produced is an absolute value of the correlation rather
> than the correlation—is this correct? I thought the R value was supposed to
> reflect the regression coefficient in terms of sign?
>
> Cheers,
> -Jonathan
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210414/f440eccd/attachment.html>


More information about the ncl-talk mailing list