ERRO COM VALORES 0 E NAs

PESSOAL, ESTOU TENTANDO GERAR A DISTRIBUIÇÃO DE WEIBULL PARA PLOTAR GRAFICO, MAS ESTOU TENDO UM ERRO QUANDO USO COMANDO: library(MASS)> dados<-read.table("inverno.txt",header=FALSE)> vento50<-fitdistr(dados[[1]],densfun="weibull")Mensagens de aviso perdidas:1: In dweibull(x, shape, scale, log) : NaNs produzidos2: In dweibull(x, shape, scale, log) : NaNs produzidos3: In dweibull(x, shape, scale, log) : NaNs produzidos4: In dweibull(x, shape, scale, log) : NaNs produzidos5: In dweibull(x, shape, scale, log) : NaNs produzidos6: In dweibull(x, shape, scale, log) : NaNs produzidos> vento50 shape scale 0.61473436 2.43536064 (0.01895222) (0.13202750) ALGUEM SABE ME DIZER O QUE SIGNIFICA OU O QUE ESTOU FAZENDO ERRADO? QUANDO TENTO RODAR MEU ARQUIVO DE DADOS COM VALORES AUSENTES OU 0, DA OUTRO ERRO WEIBULL RECISA SER >0 E QUANDO SUBSTITUO ESSES VALORES POR 0.000001 ELE DEVOLVE O ERRO ACIMA. PRECISO DE UM HELP NISSO!!!!!!! BRIGADO

Vanúcia, Neste caso, creio que a mensagem de aviso (que não é de erro) pode ser relevada. Veja o exemplo abaixo: x<-rweibull(1e3,1,1) ll<-function(th,x){ sh<-th[1]; sc<-th[2] l<-dweibull(x,sh,sc,log=T) -sum(l) } # Valores iniciais -- função 'fitdistr' lx <- log(x) m <- mean(lx) v <- var(lx) shape <- 1.2/sqrt(v) scale <- exp(m + 0.572/shape) ini<-c(shape,scale) # Limites dos parâmetros inf<-rep(1e-3,2) sup<-rep(Inf,2) fit<-optim(ini,ll,method="L-BFGS-B",lower=inf,upper=sup,hessian=T,x=x) fit$par # Estimativa sqrt(diag(solve(fit$hessian))) # Erro padrão library(MASS) fitdistr(x,densfun="weibull") Att., Rubem
participantes (2)
-
Rubem Kaipper Ceratti
-
Vanúcia Schumacher