[R] Confidence intervals for Sen slope in zyp-package

kunger at gfz-potsdam.de kunger at gfz-potsdam.de
Tue Nov 6 14:31:03 CET 2012


Hi,

I have a question about the computation of confidence intervals in the zyp package, in particular using the functions zyp.sen and confint.zyp, or zyp.yuepilon.

(1) I'm a bit confused about the confidence intervals given by zyp.sen and confint.zyp. When I request a certain confidence interval in the function, the R output seems to deliver another confidence interval, e.g. when I set level=0.95 in the function, then the output is for 0.025 and 0.975 (instead of the expected 0.05 and 0.95). See example below. Which confint statement is the right one?

(2) I checked the documentation but did not find a specification about which confidence interval is used in the zyp.yuepilon function. It seems to be the same as level=0.95 in confint.zyp (I'm not sure if this is 0.95 or 0.975 - see above).

Maybe, I'm just not seeing the obvious explanation... Could anybody advise me?

Thanks in advance,
Katy

---
My example:

> x <- c(0, 1, 2, 3, 4, 5)
> y <- c(6, 4, 1, 8, 7, 8)

# zyp.sen and confint.zyp function 

> slope <- zyp.sen(y~x)
> slope$coef

Intercept         x 
4.5000000 0.6666667 

> ci_99 <- confint.zyp(slope, level=0.99)
> ci_99

              0.005    0.995
Intercept -2.071288 10.07129
x         -3.000000  3.00000

> ci_95 <- confint.zyp(slope, level=0.95)
> ci_95

               0.025    0.975
Intercept -0.6196794 8.619679
x         -2.5000000 2.333333

> ci_90 <- confint.zyp(slope, level=0.90)
> ci_90

                0.05     0.95
Intercept  0.1230428 7.876957
x         -2.0000000 2.000000

# zyp.yuepilon
# confidence interval corresponds to nominal 0.95 interval in confint.zyp (output 0.025 0.975)

> xy_senslope <- zyp.yuepilon (y, conf.intervals=TRUE)
> xy_senslope

     lbound       trend      trendp      ubound         tau         sig       nruns     autocor  valid_frac 
-2.50000000  0.66666667  4.00000000  2.33333333  0.80000001  0.08641075  1.00000000 -0.22400000  1.00000000 
     linear   intercept 
 0.74285714  3.83333333


________________________________

Katy Unger-Shayesteh
GFZ German Research Centre For Geosciences
Section 5.4 Hydrology



More information about the R-help mailing list