logpdf or pdf in mhsample
5 次查看(过去 30 天)
显示 更早的评论
I am using 'mhsample' function for Metropolis-Hastings sampling from a posterior distribution. I am not sure if I should use pdf or logpdf as input arguments. For example, if the prior is a Gaussian, can I give the 'logpdf' argument instead of 'pdf'. What are the situations in which I should use logpdf? And how does MatLab processes 'logpdf' differently than 'pdf', does it make any difference in my final solution.
0 个评论
回答(1 个)
the cyclist
2017-12-1
The functions that are input arguments to mhsample are probability density functions. If you are actually using the logarithm of the probability density functions as inputs, then specify that with 'logpdf'.
Since you say your prior is gaussian, I'm guessing that that is simply the density (not the log), so you should use 'pdf'.
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!