Some of us are using the D-M likelihood and that requires new features to this package.
I use the following code:
if(model=='Dirichlet-multinomial'){
## recreate the alpha matrix, must match the cpp side, here
## it is linear form
alpha <- rowSums(o)*p*theta
o2 <- cbind(o[,-ind], o[,ind])
alpha <- cbind(alpha[,-ind], alpha[,ind])
resid <- compResidual::resDirM(t(o2), t(alpha))
}
where theta is equal to the exponentiated parameter estimated by the model and is used like this vector<Type> alphas = sum(otmp) * etmp * exp(log_DM_pars(0));
And an effective sample size is calculated as plogis(log(theta))*N where N is the input sample size.
This is the "linear" form (recommended), so we need to be careful because there is another form that I think may be used by SS3.
Some of us are using the D-M likelihood and that requires new features to this package.
I use the following code:
where
theta
is equal to the exponentiated parameter estimated by the model and is used like thisvector<Type> alphas = sum(otmp) * etmp * exp(log_DM_pars(0));
And an effective sample size is calculated as
plogis(log(theta))*N
where N is the input sample size.This is the "linear" form (recommended), so we need to be careful because there is another form that I think may be used by SS3.