<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title></title><style type="text/css">.felamimail-body-blockquote {margin: 5px 10px 0 3px;padding-left: 10px;border-left: 2px solid #000088;} </style></head><body>Hello<br><br>I had an NCL 2 fold question:<br><br>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<br><br>NCL has a function called student_t which calculates the two-tailed probability of the Student-t distribution.<br><br>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? <br><br>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<br><br><br><pre>dimXY = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml" target="_blank"><strong>dimsizes</strong></a>(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 = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg.shtml" target="_blank"><strong>dim_avg</strong></a> (xtmp) ; calculate means at each grid point
yAve = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg.shtml" target="_blank"><strong>dim_avg</strong></a> (ytmp)
xVar = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_variance.shtml" target="_blank"><strong>dim_variance</strong></a> (xtmp) ; calculate variances
yVar = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_variance.shtml" target="_blank"><strong>dim_variance</strong></a> (ytmp)<br><br>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<strong> </strong><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/equiv_sample_size.shtml" target="_blank"><strong>equiv_sample_size</strong></a>.<br>
sigr = 0.05 ; critical sig lvl for r
xEqv = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/equiv_sample_size.shtml" target="_blank"><strong>equiv_sample_size</strong></a> (xtmp, sigr,0)
yEqv = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/equiv_sample_size.shtml" target="_blank"><strong>equiv_sample_size</strong></a> (ytmp, sigr,0)
(4)
xN = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml" target="_blank"><strong>wgt_areaave</strong></a> (xEqv, wgty, 1., 0) ; wgty could be gaussian weights
yN = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml" target="_blank"><strong>wgt_areaave</strong></a> (yEqv, wgty, 1., 0)
(5)
iflag= False ; population variance similar
prob = <strong>ttest</strong>(xAve,xVar,xN, yAve,yVar,yN, iflag, False)
</pre><br><br><br></body></html>