# [ncl-talk] Regarding trend_manken function

Dennis Shea shea at ucar.edu
Sun Jan 3 09:47:26 MST 2021

```>From Example 1 which compares NCL's *trend_manken*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/trend_manken.shtml>
with results an *R* function

c  = (/-1,2,-3,4,-5,6,-7,8,-9,10,-11,12/)
pc = *trend_manken*(c, False, 0)     ; pc(0)=*0.2683*,   pc(1)=1.0

For comparison, on the last example R (after loading the 'Kendall' library)
returns:

< *library(Kendall)*
> q  <- c(-1,2,-3,4,-5,6,-7,8,-9,10,-11,12)
> x  <- c(1,2,3,4,5,6,7,8,9,10,11,12)
> qx <-Kendall(x,y)
> qx
R returns
tau = 0.0909, *2-sided *pvalue =*0.7317*    (Note: 1-0.7317=
*0.2683* which matches NCL)
====

So two-sided
====

Run the above example in Python.  That should give you a baseline comparison.
*******************************************************************************
Another R example:
*https://www.statology.org/mann-kendall-trend-test-r/*
<https://www.statology.org/mann-kendall-trend-test-r/>
*******************************************************************************

prc = (/31.69,29.77,31.70,33.06,31.31,32.72,31.18,29.90,29.17,31.48,28.11,32.61
\
,31.31,30.96,28.40,30.68,33.67,28.65,30.62,30.21,28.79,30.92,30.92,28.13
\
,30.51,27.63,34.80,32.10,33.86,32.33,25.69,30.60,32.85,30.31,27.71,30.34
\
,29.14,33.41,33.51,29.90,32.69,32.34,35.01,33.05,31.15,36.36,29.83,33.70
\
,29.81,32.41,35.90,37.45,30.39,31.15,35.75,31.14,30.06,32.40,28.44,36.38
\
,31.73,31.27,28.51,26.01,31.27,35.57,30.85,33.35,35.82,31.78,34.25,31.43
\
,35.97,33.87,28.94,34.62,31.06,38.84,32.25,35.86,32.93,32.69,34.39,33.97
\
,32.15,40.16,36.32/)

pc = *trend_manken(*prc, False, 0)
print(pc)
print("============")
*PC = 1-pc(0)*
print("PC=1-pc(0)="+PC)

Variable: pc
Type: float
Total Size: 8 bytes
2 values
Number of Dimensions: 1
Dimensions and sizes:	[2]
Coordinates:
(0)	0.9997079
(1)	0.03999999
(0)	============
(0)	*PC=1-pc(0)=0.000292063   <=== matches R*

On Sat, Jan 2, 2021 at 11:45 PM Ipsita Putatunda via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Dear ncl users,
> I have gone through the function trend_manken, but I have few doubts as
> follows-
> The probability we are getting from this function is two-tailed or
> one-tailed?
> Using this function I am getting one of my trend probability 0.97 whereas
> using python I am getting the value 0.022 which is giving a significantly
> strong trend.
> Any help in this regard would be highly appreciated.
>
> Thanking you,
> Ipsita
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210103/b9090738/attachment.html>
```