# [R] KS test pvalue estimation using mctest (library truncgof)

D ANIELLO CLAUDIA (MPS - 05966) claudia.d'aniello at banca.mps.it
Wed May 2 15:50:49 CEST 2007

```Hi,
I'm trying to evaluate a Monte Carlo p-value (using truncgof package) on
a left truncated sample.
>From an empirical sample I've estimated a generalized pareto
distribution parameters (xi, beta, threshold) (I've used fExtremes pkg).
I'm in doubt on what of the following command is the most appropriate:
Let:
x<-sample
t<-threshold
xt<-x[x>t]
xihat<-gpdFit(x, threshold=t, type = "pwm")\$par.ests
betahat<-gpdFit(x, threshold=t, type = "pwm")\$par.ests
(1)
ks.test(xt,"pgpd",list(xi=xihat,beta=betahat),H=t,estfun =
"as.list(gpdFit(x, 0)\$par.ests)", tol = 1e-02)
(2)
ks.test(xt,"pgpd",list(xi=xihat,beta=betahat),H=t,estfun =
"as.list(gpdFit(x, t)\$par.ests)", tol = 1e-02)
(3)
ks.test(xt,"pgpd",list(xi=xihat,beta=betahat,mu=t),estfun =
"as.list(gpdFit(x, t)\$par.ests)", tol = 1e-02)

Someone have ever faced this problem? I need to understand the role of
threshold in the Monte Carlo sampling from the GPD.
In the 1st case I've obtained high value of statistics and p-value, in
the second same value of statistic and very low p-value, in the 3rd low
statistic and p-value always equal to 1.

Thank you very much in advance
Regards
Claudia

```