[R] error in ZIGP package and optim

chenandfuok xdchen at hutc.zj.cn
Thu Dec 1 06:37:08 CET 2011


Dear all: I am trying to use the response.zigp and est.zigp from the ZIGP
package. Firstly, I generated a simple data via response.zigp and then I try
to fit them by est.zigp function, this is the code:
---------------------------------
> library(ZIGP)
> #try-ZIGP-1
> n<-100
> X<-matrix(c(rep(1,n),runif(n*2,0,1)),n,3)
> W<-matrix(c(rep(1,n),rbinom(n,1,0.5)),n,2)
> Z<-matrix(c(rep(1,n),rbinom(n,1,0.5)),n,2)
> beta<-c(1,-2,1)
> alpha<-c(1,1.5)
> gamma<-c(-1,2)
> y<-response.zigp(X,W,Z,beta,alpha,gamma)
> x1<-as.vector(X[,1])
> x2<-as.vector(X[,2])
> x3<-as.vector(X[,3])
> w1<-as.vector(W[,1])
> w2<-as.vector(W[,2])
> z1<-as.vector(Z[,1])
> z2<-as.vector(Z[,2])
> fm.X<-~x1+x2+x3
> fm.W<-~1
> fm.Z<-~z1+z2
> est.zigp(y,fm.X,fm.W,fm.Z,Offset=rep(1,length(y)),init=FALSE)
-----------------------------
Then I get the *error:*
----------------------------
Error in optim(par = start.delta, fn = loglikelihood.zigp, gr = gradient,  : 
  initial value in 'vmmin' is not finite
--------------------------------
Any help you can give me would be greatly appreciated.


--
View this message in context: http://r.789695.n4.nabble.com/error-in-ZIGP-package-and-optim-tp4127053p4127053.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list