0

I am using the TMB package in R, and I want to use a density distribution which is not available in the R style distribution.

How should I include it? I didn't find anything in the documentation.

For example, I want to use Simplex distribution, which I have already written in R:

dsimplex <- function(y, mu, sigma, log=TRUE){
 dis <- (y-mu)^2 / (y*(1-y)*mu^2 *(1-mu)^2)
 dsim <- -0.5*log(2*pi) -0.5*log(sigma) -
 (3/2)*log(y*(1-y)) - (1/(2*sigma))*dis
 if(log == FALSE){dsim <- exp(dsim)}
 return(dsim)
}

and it is available in simplexreg and Stan packages.

  • What is the best approach to deal with it? (I would like to have an external file which contains this density, and call it from the file that I am writing my log likelihood)
ChrisMM
10.1k20 gold badges41 silver badges60 bronze badges
asked Apr 11, 2020 at 0:16
3
  • I'm thinking that asking at the github/TMB (also) about this and reporting back the results here would help others that want to template their particular distribution would be helpful. Commented Apr 11, 2020 at 4:03
  • Tks, I just posted it there as well groups.google.com/forum/#!topic/tmb-users/3_ElYPKPoJ4 Commented Apr 13, 2020 at 17:48
  • In the last paragraph of kaskr.github.io/adcomp/_book/Tutorial.html it says how. And in the TMB group (link above), they also answered. Commented May 11, 2020 at 21:01

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.