Search code examples
rtestingstatisticsthresholdp-value

Pettitt - significance levels in R


I am trying to implement the Pettitt test on R. I am coding by myself but with the reference of the built-in function pettitt.test of R.(https://www.rdocumentation.org/packages/trend/versions/1.1.4/topics/pettitt.test)

I could implement it successfully, but my question is about the p-value. I am calculating the p-value with this equation:

p=2e^((-6U ̂^2)/(n^3+n^2 ))

being U the value of the test statistic and n the length of my sample. (I have checked and I got the same than with the built-in function pettitt.test)

For a 5% confidence interval, the alternative hypothesis should be true if this p-value is lower than 0.5? or 0.05? I am confused by the documentation of R (weblink previously shared) that says lower or equal than 0.5, and for the Pettitt's paper (1979) page 5 that also indicates lower or equal than 0.5

Any help to clarify this question?


Solution

  • What the paper says is

    ... where the approximation holds good, accurate to two decimal places, for p(OA)<0.5

    (emphasis added). That is, it's not about the critical level at which you want to reject the null hypothesis (typically p=0.05), but about what range of values the approximation holds for.

    Most R functions and packages simply return the p-value and let the user decide what they want to do about interpreting it (i.e. reject or fail to reject the null hypothesis at a given alpha-level, treat it as a continuous ("Fisherian") strength of evidence against the null hypothesis, etc.).

    If you wanted you could have your function issue a warning if the calculated value of p is >0.5 (e.g. "approximation of the p-value may be unreliable")


    Pettitt, A. N. “A Non-Parametric Approach to the Change-Point Problem.” Journal of the Royal Statistical Society. Series C (Applied Statistics) 28, no. 2 (1979): 126–35. https://doi.org/10.2307/2346729.