iicBIRT=function(theta,alpha,beta,phi,gamma0=NULL,gamma1=NULL,model=c("beta","samejima","simplex","normal")){
  model=match.arg(model)
  if(phi<0) stop("The dispersion parameter phi should be larger than 0")
  if(is.null(gamma0)) gamma0=-Inf
  if(is.null(gamma1)) gamma1=Inf

  if((length(beta)!=1) |   (length(alpha)!=1) | (length(phi)!=1) | (length(gamma0)!=1) | (length(gamma1)!=1))
    stop("Item parameters should be of length 1")

  if(model=="beta"){
    ln_phi=log(phi)
    a = exp(.5* (alpha*theta + beta+ln_phi));
    b  = exp(.5* (-alpha*theta - beta+ln_phi));
    info0=-alpha^2*((trigamma(a+b)*((a-b)/2)^2-trigamma(a)*(a/2)^2-trigamma(b)*(b/2)^2))
  }

  if(model=="simplex"){
    dsimplex=function (y, m, s2){  #from rmutil by Swihart & Lindsey (2022) but with minor adjustment
      tmp <- -((y - m)/(m * (1 - m)))^2/(2 * y * (1 - y) * s2) -
        (log(2 * pi * s2) + 3 * (log(y) + log(1 - y)))/2
      return(exp(tmp))
    }
    infX2=function(x,theta,beta,alpha,phi){
      mu=stats::plogis(alpha*theta+beta)
      tmp= ((x - mu) * (x * (2*mu - 1) - mu^2))/((x - 1) * x * phi * (1 - mu)^3 * mu^3) * alpha * mu * (1-mu)
      return(tmp^2*dsimplex(x,mu,phi))
    }
    info0=c()
    for(i in 1:length(theta)) info0[i]=stats::integrate(infX2,0.0001,.9999,theta=theta[i],beta=beta,alpha=alpha,phi=phi)$value
  }

  if(model=="samejima") info0=rep(alpha^2/phi,length(theta))
  if(model=="normal") info0=rep(alpha^2/phi,length(theta))

  info_full=c()
 if((gamma0!=-Inf) | (gamma1!=Inf)){
  for(i in 1:length(theta)){
    info_full[i]=alpha^2*stats::plogis(-(gamma0-alpha*theta[i]))^2*stats::plogis((gamma0-alpha*theta[i]))+                     #info lower bound
       (stats::plogis((gamma1-alpha*theta[i]))-stats::plogis((gamma0-alpha*theta[i])))*
       ((-alpha*(stats::plogis((gamma1-alpha*theta[i]))*stats::plogis(-(gamma1-alpha*theta[i]))-stats::plogis((gamma0-alpha*theta[i]))*stats::plogis(-(gamma0-alpha*theta[i])))/(stats::plogis((gamma1-alpha*theta[i]))-stats::plogis((gamma0-alpha*theta[i]))))^2+  #info 0<X<1
          info0[i]) +       # info traditional model
       alpha^2*stats::plogis((gamma1-alpha*theta[i]))^2*stats::plogis(-(gamma1-alpha*theta[i]))                       #info upper bound
  }
 } else info_full=info0

 return(info_full)
 }
