Message-ID: <20090129115825.N7XP6.1850951.root@mp06>
Date: 2009-01-29T16:58:25Z
From: rkevinburton at charter.net
Subject: Help
In-Reply-To: <8ec2da0f0901290822o7768e27hda097e8dfefad1d2@mail.gmail.com>
You could look into ' try' and set it up to catch errors and do the appropriate thing in your error handler. I don't have the exact syntax at hand right now but looking at ?try or ?tryCatch I think will do what you want.
Kevin
---- Alexandra Almeida <alexandrarma at gmail.com> wrote:
> 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]]
>