Hello,
First of all, you should say which packages you are using. There is a
function ks.boot in package Matching and there are functions pgev in
several packages. For instance, package evd.
Apparently there is nothing wrong with ks.test, you simply are unable to
call ks.boot. So, write a ks_boot function with the same arguments as
ks.test plus an extra 'nboots' argument.
ks_boot <- function(x, y, ...,
alternative = c("two.sided", "less",
"greater"),
exact = NULL, nboots = 1000){
alt <- match.arg(alternative)
n <- length(x)
D <- numeric(nboots)
p <- numeric(nboots)
for(i in seq_len(nboots)){
idx <- sample(n, n, replace = TRUE)
ks <- ks.test(x[idx], y, ..., alternative = alt, exact = exact)
D[i] <- ks$statistic
p[i] <- ks$p.value
}
list(D = mean(D), p.value = mean(p), nboots = nboots)
}
Hope this helps,
Rui Barradas
Em 12-10-2012 04:09, Louise.Wilson at csiro.au escreveu:> Hi,
>
> I am performing GEV analysis on temperature/precipitation data and want to
use the ks.boot function but I am unsure of how to implement it using the pgev
distribution.
>
> For example:
>
> ks.test(data,pgev,shape,location,scale)
> ks.boot(data,(distribution
parameters?),alternative="pgev",nboots=1000)
>
> Any advice? Apologies in advance if I have used the wrong email address.
>
> Regards,
> Louise Wilson
>
> Louise Wilson
> Climate Projections Project Officer
> CSIRO Climate Adaptation Flagship
> National Resource Management (NRM)
> Pacific-Australia Climate Change Science and Adaptation Planning Program
(PACCSAP)
>
> CSIRO Marine and Atmospheric Research
> Private Bag 1 (107-121 Station St)
> Aspendale, Victoria 3195
> P: +61 3 9239 4619 | F: +61 3 9239 4444 | E: louise.wilson at
csiro.au<mailto:louise.wilson at csiro.au>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.