<div dir="ltr"><div>Hi Jonathan,</div><div><br></div><div>Sorry for the delay. I did not see this. I guess I was asleep-at-the-wheel. <br></div><div><br></div><div>Example 3 of the <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/regline_stats.shtml"><b>regline_stats </b></a></div><div>Shows NCL results compared with the <b>R </b>results. They match. :-)</div><div>---<br></div><div><br></div><div>To be honest, I can not remember the details of this function.</div><div><br></div><div>
r2 = SSR/SST ; r2 = <a href="https://en.wikipedia.org/wiki/Coefficient_of_determination"><b>coefficient of determination</b></a>. <br></div><div><br></div><div>From Wikipedia: r2 "the <b>coefficient of determination</b>, denoted <i>R</i><sup>2</sup> ...<b> </b>is the proportion of the variance in the
dependent variable that is predictable from the independent variable(s)."</div><div><br></div><div>"proportion" is a value from 0-to-1</div><div><br></div><div>Why, the following?<br></div><div>r = sqrt(r2) ; <b>multiple (overall) correlation</b></div><div><br></div><div>Sorry, I just can not remember .... but ... it agrees with R.</div><div>This is a terrible answer, I just don't remember the details of why I did what I did!</div><div><br></div><div>I can pursue this further if you wish.</div><div><br></div><div>Regards</div><div>D<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 12, 2021 at 9:51 AM Buzan, Jonathan via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi NCL-Talk,<br>
<br>
I was producing figures using regline_stats and noticed that when I had negative regression coefficients I had a positive correlation R value. <br>
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. <br>
<br>
r2 = SSR/SST ; r2 = coefficient of determination. It is<br>
; the square of the Pearson correlation<br>
; coefficient between the observed<br>
; and modeled (predicted) data values<br>
; of the dependent variable. It is<br>
; another measure of 'goodness of fit.'<br>
; biased high, particularly for small N<br>
<br>
r2a = r2-(1-r2)*NP/tofloat(dof) ; adjusted r2... better for small N<br>
r = sqrt(r2) ; multiple (overall) correlation<br>
<br>
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?<br>
<br>
Cheers,<br>
-Jonathan<br>
<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>