iccBIRT=function(theta,alpha,beta,phi,gamma0=NULL,gamma1=NULL,model=c("beta","samejima","simplex","normal")){
  model=match.arg(model)
  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%in%c("beta","simplex"))
    out=(stats::plogis(gamma1-alpha*theta) - stats::plogis(gamma0-alpha*theta))*stats::plogis(alpha*theta+beta)+(1-stats::plogis(gamma1-alpha*theta))

  if(model=="samejima")
    out=(stats::plogis(gamma1-alpha*theta) - stats::plogis(gamma0-alpha*theta))*
        SB_mean(-(alpha*theta+beta)/sqrt(phi),1/sqrt(phi))+
        (1-stats::plogis(gamma1-alpha*theta))

  if(model=="normal")
    out=(stats::plogis(gamma1-alpha*theta) - stats::plogis(gamma0-alpha*theta))*(alpha*theta+beta)+(1-stats::plogis(gamma1-alpha*theta))

  return(out)
}





