2

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?

Sss
  • 427
  • 2
  • 8

1 Answers1

1

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.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • Thank you. As I understood from your answer, I should compare the p-value with the significance level of my interest (in my case p-value <= 0.05), but, this equation to estimate the p-value could be considered good only if the p-value resulting from it is <= 0.5. In case the p-value resulted from this equation is higher than 0.5, how can I estimate the p-value? – Sss Feb 07 '21 at 16:50
  • Yes, that's right. For more accurate p-values I suppose you could compute additional terms of the infinite sum given in eq 2.11 of the paper ... ? But that's really a separate question (and one for [CrossValidated](https://stats.stackexchange.com), not Stack Overflow) – Ben Bolker Feb 07 '21 at 17:16