[ncl-talk] NCL serial correlation and student_t

Sri Nandini snandini at marum.de
Fri Jan 19 08:16:49 MST 2018


Hello

I had an NCL 2 fold question:

1) In the NCL page https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml  the ttest function uses  the Student's t-test with the 2 tailed returned probabilities.  BUT

NCL has a function called student_t which calculates the two-tailed probability of the Student-t distribution.

So which one should i take if i wish to do a ttest (2tailed) that takes the serial correlation from the data into account say between 2 temperature datasets? 

With the NCL function equiv_sample_size you can get the true degrees of  freedom. You can then calculate the p-values using the function student_t ,which  allows you to prescribe the correct degrees of freedom. BUT: i already use the equiv_sample_size function to do my ttest as shown here: in example 4:https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml


dimXY = dimsizes(x)
  ntim  = dimXY(0)
  nlat  = dimXY(1)
  mlon  = dimXY(2)
                                  (1)
  xtmp = x(lat|:,lon|:,time|:)       ; reorder but do it only once [temporary]
  ttmp = y(lat|:,lon|:,time|:)
    
                                  (2)
  xAve = dim_avg (xtmp)              ; calculate means at each grid point 
  yAve = dim_avg (ytmp)
  xVar = dim_variance (xtmp)         ; calculate variances
  yVar = dim_variance (ytmp)

Specify a critical significance level to test the lag-one auto-correlation coefficient and determine the (temporal) number of
equivalent sample sizes in each grid point using equiv_sample_size.

  sigr = 0.05                        ; critical sig lvl for r
  xEqv = equiv_sample_size (xtmp, sigr,0)
  yEqv = equiv_sample_size (ytmp, sigr,0)
                                  (4)
  xN   = wgt_areaave (xEqv, wgty, 1., 0)    ; wgty could be gaussian weights 
  yN   = wgt_areaave (yEqv, wgty, 1., 0) 
                                  (5)
  iflag= False                        ; population variance similar
  prob = ttest(xAve,xVar,xN, yAve,yVar,yN, iflag, False) 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180119/7b2431f2/attachment.html>


More information about the ncl-talk mailing list