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

Missing term in multivariate logistic likelihood? #24

Open
quang-huynh opened this issue Jun 20, 2022 · 8 comments
Open

Missing term in multivariate logistic likelihood? #24

quang-huynh opened this issue Jun 20, 2022 · 8 comments

Comments

@quang-huynh
Copy link

I was working through the derivation of Tech Doc equation 11, which seems to be missing a 0.5 term.

If the log-likelihood is -(A-1) * T * log(tau) - 0.5 * sum(eta^2)/tau^2, then substitution of the equation just above no. 11 should result in -0.5 * (A - 1) * T * log(tau^2) + constant since log(tau) = 0.5 * log(tau^2). Schnute and Richards (1995) also seem to be missing this 0.5 term in Table 4, L14, but the derivation is analogous to Appendix D of the ADMB manual which does have this 0.5 term.

Does the ADMB code have the 0.5 in the likelihood?

@cgrandin
Copy link
Collaborator

Which document are you looking at? i.e. which doc is where "Tech doc equation 11" is from? Can you put a link here..

@quang-huynh
Copy link
Author

quang-huynh commented Jun 21, 2022

It's in iSCAMTechDoc.pdf

@cgrandin
Copy link
Collaborator

OK, where are you getting this equation from: -(A-1) * T * log(tau) - 0.5 * sum(eta^2)/tau^2

@quang-huynh
Copy link
Author

That's equation L.9 in Table 3 of Richards and Schnute (1995), after taking the log

@cgrandin
Copy link
Collaborator

cgrandin commented Jun 21, 2022

I'm having a hard time getting what you have from Eq 9, I get this after logging it:

-T * log(sqrt(2pi) * tau)    + T/2 * log(A)   - (1/(2 * tau ^2) + sum(sum(eta ^ 2))

So log(A) would have to be equal to log(sqrt(2pi) * tau) to subtract the T's in the first two terms, am I missing something?

@quang-huynh
Copy link
Author

I have -T * (A-1) * [log(sqrt(2pi)) + log(tau)] for the first term.

Both log(sqrt(2pi)) and T/2 * log(A) can be dropped since they are constants

@cgrandin
Copy link
Collaborator

The ADMB source code is completely undocumented and convoluted, and every time I look at it I feel a little sick.

I think it could be this:
https://github.com/admb-project/admb/blob/baf480ffe84bc8c1054a3334d15a9885d0bceed1/contrib/statslib/dmultinom.cpp#L50

@quang-huynh
Copy link
Author

I think that's the link to the multinomial likelihood. I see the dmvlogistic call in iscam.tpl for the multivariate logistic likelihood.

Looks like dmvlogistic is also distributed in ADMB:
https://github.com/admb-project/admb/blob/main/contrib/statslib/dmvlogistic.cpp

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

2 participants