[ncl-talk] Mann-Kendall test for n<10

Dennis Shea shea at ucar.edu
Tue Dec 20 11:49:40 MST 2016


An alternative (not tested)
http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_
indices.shtml
http://www.ncl.ucar.edu/Applications/bootstrap.shtml

=====
Let q(ntim,nlat,mlon);

      nDimTime       = 0
      dimq                = dimsizes(q)
      NTIM               = dimq(nDimTime)     ; all times
      nlat                  = dimq(1)
      mlon                = dimq(2)

   nBoot      = 5000          ; user set
   method     = 1             ; sample with replacement

   nSubTime   = 7             ; subset nSubTime < NTIM

   do nb=0,nBoot-1
      IW = *generate_sample_indices*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/generate_sample_indices.shtml>(NTIM,method))
      trendBoot(nb) = *dtrend_n*(q(IW,:,:),False,nDimTime)    ; total length
or
      iw = IW(0:nSubTime-1)       ; ntim random subsamples
      trendBoot(nb) = *dtrend_n*(q(iw,:,:),False,nDimTime)
   end do

   ii = dim_pqsort_n(trendBOOT, 2, nDimTime)              ; bootstrap
trends in ascending order

                                                          ; at every grid point

   qBootLow = trendBoot(round(0.025*(nBoot-1),3),:,:)     ; index for
sorted array  ;  2.5% lower confidence bound
   qBootMed = trendBoot(round(0.500*(nBoot-1),3),:,:)     ; 50.0%
median of bootstrapped estimates
   qBootHi  = trendBoot(round(0.975*(nBoot-1),3),:,:)     ; 97.5%
upper confidence bound




On Tue, Dec 20, 2016 at 11:09 AM, Dennis Shea <shea at ucar.edu> wrote:

> As noted in the documentation: "The series must be at least 10 values."
>
> I think that   5 < n < 10   necessitates a table-lookup which is currently
> not available from within NCL.
>
> Sorry
>
> On Tue, Dec 20, 2016 at 9:55 AM, Aaron Spring <aaron.spring at mpimet.mpg.de>
> wrote:
>
>> I try to detect 5- to 10-year trends. I would like to use the
>> Mann-Kendall test. This is included in NCL6.3.0.
>>
>> Unfortunately, I always get probability = 0 and trend = 0 if I use less
>> than 10 data points for the test. Is there maybe a cut-off in the
>> implementation?
>>
>> The description of the trend_manken links to
>> <http://vsp.pnnl.gov/help/Vsample/Design_Trend_Mann_Kendall.htm>
>> http://vsp.pnnl.gov/help/Vsample/Design_Trend_Mann_Kendall.htm. There it
>> links to Gilberts 1987 book.
>> <http://www.osti.gov/scitech/servlets/purl/7037501/>
>> http://www.osti.gov/scitech/servlets/purl/7037501/ p. 272 Table A18
>> shows probability tables for 5<n<10.
>>
>> Has anyone faced the same problem or maybe already implemented that?
>>
>> Unfortunately, at my work station I cannot have a look into the source
>> code as I only see .a files.
>>
>> --
>> Aaron Spring
>> Room 229
>> Max Planck Institute for Meteorology
>> Bundesstr. 53, 20146 Hamburg, Germany
>> mailto:aaron.spring at mpimet.mpg.de <aaron.spring at mpimet.mpg.de>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161220/804c982b/attachment.html 


More information about the ncl-talk mailing list