[ncl-talk] Correlation in regline_stats

Buzan, Jonathan jbuzan at purdue.edu
Mon Apr 12 09:51:35 MDT 2021


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




More information about the ncl-talk mailing list