One thing jumps out...you seem to be missing a fourth
"0" in your
optim() line. It should read:
optim.out <- optim(par = c(0,0,0,0), scobit.ll, y = y, X = X,
method="BFGS",control=list(fnscale = -1), hessian = T)
In addition, I think you may have both some missing and extra negative
signs in this part of your log-lik function:
outA <- sum(-y*log((1+exp(-mu))^a))
outB <- sum((1-y)*log(1-(1+exp(-mu))^a))