<div dir="ltr">Hi Sri,<div>First, I highly recommend you speak with a statistician or your advisor about the issues we have been discussing. Also review the documentation of the NCL functions regCoef and dtrend. It is important that you fully understand the particulars about these mathematical functions and to know exactly what your code is doing.</div><div><br></div><div>To answer the questions from your first reply:</div><div><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> Just to clarify here<span> </span></span><span class="gmail-m_352235430939834898_Tgc gmail-m_352235430939834898_s8w" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">the<span> </span><b>regression coefficient</b><span> </span>is synonymous with the slope or<span> </span><b>trend</b>?<br>> The main aim is to plot out the trend and overlay with p values.<br><br>Did you try testing it? Here's a simple test:</span></div><div><span class="gmail-m_352235430939834898_Tgc gmail-m_352235430939834898_s8w" style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="font-size:12.8px">a = (/4.5,3.2,-1.5,0.5,1.7,2.9/)</div><div style="font-size:12.8px">rc = regCoef(ispan(0,dimsizes(a)-1,1),a)</div><div><span style="font-size:12.8px">tt = dtrend(a,True)</span><br></div><div><span style="font-size:12.8px">print(rc+" "+tt@slope)</span><br></div></span></div><div><span class="gmail-m_352235430939834898_Tgc gmail-m_352235430939834898_s8w" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br>Again, please review the documentation for these functions, and try them out using simple tests as is shown above. <br><br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> Is there another way to calculate the significance apart from:<span> </span></span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(255,255,255)"><span style="font-size:12.8px">> finobs_rtt = (/ (1.-betainc(df/(df+tval^2), df/2.0, beta_b))*100. /)  ; probability in %?<br><br>I do not know of one, but you should consult a statistician for this.<br><br>> Is it possible to do ttest on the trend analysis?</span></div><br></div><div>You can do a t-test if you instead choose to do an epoch difference calculation instead of a trend calculation. In an epoch difference calculation you (for example) would subtract the average of the first 15 years of your data from the average of the last 15 years of data. Ask a colleague or your advisor on whether this would be appropriate for your situation.  </div><div>---------------------</div><div>With regards to the code you attached in your last email, on first glance I do not see anything amiss with your script. However, as I noted in a previous reply, the slope attribute returned from dtrend is in units of per time step. For your script, as you have 80 years of annual 2m Temperature data,  you will want to multiply the returned slope from dtrend by 80.  finobs1 = finobs1*80.</div><div>Adam</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 7, 2018 at 4:00 AM, Sri Nandini <span dir="ltr"><<a href="mailto:snandini@marum.de" target="_blank">snandini@marum.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>Hello<br> Using the given code, i attach the 2 pltos i get from doing trend analysis on T2m and getting the significance. IT seems really small and i am not convinced these are the right values.<br>Could someone please have a look at the script below which i used and confirm i use the right scripting for getting getting significance of and linear trends for plotting.<br>Much appreciated<br><br>Here is the part of my code that works:<br><br>yrStrt = 2020<br>yrLast = 2099<br>;=============================<wbr>==============================<wbr>========<br>f= addfile("T2M_45.nc", "r") ;<br>time   = f->time<br>YYYY   = cd_calendar(time,-1)/100      <wbr>                              <wbr>          ; entire file<br>iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)<br>T2    = f->TREFHT(iYYYY,:,:)<br>printVarSummary(T2)           <wbr>                              <wbr>                   ; (time, lat,lon)<br>T2=T2-273.15<br>T2@_FillValue = -9.96921e+36       <br>T2@units= "degC"<br>printVarSummary(T2)           <wbr>                              <wbr>                   ; (time, lat,lon)<br><br>;=============================<wbr>==============================<wbr>============<br>;Very important to give the year dimension its cordinates<br>;=============================<wbr>==============================<wbr>============<br>  yyyymm = cd_calendar(T2&time, -1)<br>   yyyy   = yyyymm/100<br><br>   dimx = dimsizes(T2)<br>   ntim = dimx(0)                ; all years and months<br>   nlat = dimx(1)<br>   mlon = dimx(2)<br><br>   year  = ispan(yyyy(0), yyyy(ntim-1), 1)<br>   nyrs  = dimsizes(year)<br><br>;=============================<wbr>==============================<wbr>==============<br> T2mm    = month_to_annual(T2, 1) <br> T2mm&year  = year<br> printVarSummary(T2mm)   <br>;=============================<wbr>==============================<wbr>==<br>; Calculate the regression coefficients (slopes)    <br>;=============================<wbr>==============================<wbr>==<br>  <br>tarr1 = T2mm(lat|:,lon|:,year|:)   <br>     printVarSummary(tarr1)   <br>                              <wbr>                           ; (time, lat,lon)        <br>tttt1 = dtrend_msg(ispan(0,dimsizes(<wbr>tarr1&year)-1,1),tarr1,True,<wbr>True)   <br>        printVarSummary(tttt1)   <br>finobs1 = tarr1(:,:,0)                  <wbr>                       <br>finobs_rtt1 = finobs1                       <wbr>                     <br>finobs1 = (/ onedtond(tttt1@slope, (/dimsizes(tarr1&lat),<wbr>dimsizes(tarr1&lon)/) ) /)   ; reform the slope attribute to 2D (lat x lon) array. This will be used for plotting the trend<br>       printVarSummary(finobs1)    <br><br>tval1 = tarr1(:,:,0) <br>df1 = tarr1(:,:,0)                  <wbr>                              <wbr>                              <wbr>               <br>rc1 = regcoef(ispan(0,dimsizes(<wbr>tarr1&year)-1,1),tarr1,tval1,<wbr>df1)                           ; tval and df are filled in by regcoef<br><br>df1 = equiv_sample_size(tarr1,0.05,<wbr>0)                            <wbr>                           ; Optional! over rule df returned from regcoef. <br><br>df1 = df1-2                                      <wbr>                              <wbr>        ;regcoef/equiv_sample_size return N, need N-2<br>beta_b1 = tval1<br>beta_b1 = 0.5<br><br>printVarSummary(df1)          <wbr>                              <wbr>                         ;lat,lon  <br>printVarSummary(tval1)        <wbr>                              <wbr>                         ;lat,lon <br><br> finobs_rtt1 = (/ (1.-betainc(df1/(df1+tval1^2), df1/2.0, beta_b1))*100. /) ; significance of trends expressed from 0 to 100%<br>printVarSummary(finobs_rtt1)  <wbr>     <br>;print(finobs_rtt1)           <wbr>                             ; (time, lat,lon)<br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>