[R] vglm regression with weibull distribution

justin bem justin_bem at yahoo.fr
Wed Aug 17 20:43:05 CEST 2011


Dear all,

I'm facing a problem in estimation of glm model with weibull distribution. I run this :

eqn0<-formula(fdh~cup1+cup2+cup3+cup4+fin1+vd1+cm2+cm4+milieu+cpro1+cpro2+cpro3a+cpro3b+schef+log(y))
regWeib0<-vglm(eqn0,family=weibull,subset(br, fdh<1))

I have en estimation but there is a message saying that regularity conditions are violated :

Message d'avis :
In eval(expr, envir, enclos) :
  MLE regularity conditions are violated(shape <= 2) at the final iteration


Then I haved try to apply solution provide in help of the package that consisted to use lschape="logoff" and eschape=list(offset=-2)

regWeib0<-vglm(eqn0,family=weibull(lshape='logoff',eshape=list(offset=-2)),subset(br, fdh<1))


Erreur dans if ((temp <- sum(wz[, 1:M, drop = FALSE] < wzepsilon))) warning(paste(temp,  : 
  l'argument n'est pas interprétable comme une valeur logique
De plus : Message d'avis :
In log(theta + offset) : production de NaN


Finaly i use the above function to find initial value for shape (a) and scale (b) 

weibullPar<-function(x){
 f<-function(p,mu=mean(x), sig=((length(x)-1)*var(x))/length(x)){
      n<-length(x)
      a<-p[1]
      b<-p[2]
      t1<-(mu-b*gamma(1+1/a))^2
      t2<-(sig-((b^2)*gamma(1+2/a)-mu^2))^2
      rval<-t1+t2
      rval
  }
  optim(c(1,1),f)$par
}

With the founded initial values I have I have the message. But When try great initial value for ishape and iscale I have this 


regWeib0<-vglm(eqn0,family=weibull(lshape='logoff',lscale='loge',eshape=list(offset=-2),ishape=22,iscale=6),subset(br, fdh<1))
Messages d'avis :
1: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
2: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
3: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
4: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
5: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
6: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
7: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
8: In checkwz(wz, M = M, trace = trace, wzeps = control$wzepsilon) :
  1525 elements replaced by 1.819e-12
9: In eval(expr, envir, enclos) :
  MLE regularity conditions are violated(shape <= 2) at the final iteration


MLE regularity condition are still violated but a solution is find !



Can some one help me ? 



Justin BEM
BP 1917 Yaoundé
Tél (237) 76043774 



More information about the R-help mailing list