Hi,

    Test <- function(x, y, paired) {
       res <- try( ks.test(...), TRUE )
      if( inherits( res, "try-error" ) )
          res <- NA
      res
    }


Regards


patricia


> Date: Thu, 29 Jan 2009 13:22:11 -0300
> From: alexandra...@gmail.com
> To: r-help@r-project.org
> Subject: [R] Help
> 
> Hi everybody!
> 
> I´m with a problem that probably is easy for you, but I really don´t know
> how to solve.
> On the following script:
> 
> for(j in 1:length(limiares))
> {
>    excessos<-limiares[j]-estacao[estacao<limiares[j]]
>    par.ests<-gpd(-(estacao),threshold=-limiares[j],method=c("pwm"))$par.est
> 
> GOF.test<-ks.test(excessos,"pgpd",xi=par.ests[1],beta=par.ests[2])$p.value
> 
> tabs[j,]<-c(par.ests,gpd(-(estacao),threshold=-limiares[j],method=c("pwm"))$par.ses,GOF.test,length(excessos))
> }
> 
> I´ve found the error for some values of i: Erro em ks.test(excessos, "pgpd",
> xi = par.ests[1], beta = par.ests[2]) : NA/NaN/Inf em chamada de função
> externa (argumento 1)
> 
> *My question is: This warning stop the "for" and I don´t want it, is there
> some way to continue the "for", and for the cases where the function cannot
> calculate the ks.test for the i just leave a NA as answer???*
> 
> Thank you *very much*!!!
> 
> Alexandra Almeida
> 
> 
> 
> -- 
> Alexandra R M de Almeida
> 
>       [[alternative HTML version deleted]]
> 

_________________________________________________________________


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to