Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand to include the Dirichlet-multinomial #2

Open
Cole-Monnahan-NOAA opened this issue Oct 3, 2024 · 0 comments
Open

Expand to include the Dirichlet-multinomial #2

Cole-Monnahan-NOAA opened this issue Oct 3, 2024 · 0 comments

Comments

@Cole-Monnahan-NOAA
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant