How to generate random samples for a custom probability density function
조회 수: 17 (최근 30일)
이전 댓글 표시
I am using 'fmincon' and 'patternsearch' of the OptimizationToolbox, R2016a. My ObjectiveFunction involves estimating the mean and variance of many arbitrary pdfs that are 1) not necessarily integrating to 1, and 2) generated in realtime by other custom functions I wrote so that the pdfs are numerically approximated rather than having any explicit analytical expression. In other words, each pdf is merely expressed as a vector 'likelihood' as a function of x, and the shape/expression of the pdf is unknown and changes as other parameters in the ObjectiveFunction vary across iterations. So I guess I should generate random samples for each pdf and estimate the stats based on these samples. However, I need the sampling to be done as fast as possible because I might need >10000 samples each time.
댓글 수: 0
답변 (1개)
Alan Weiss
2016년 3월 29일
I think that the first thing you need to do is scale your likelihood so that it becomes a real pdf that integrates to 1. You can call integral for that purpose. Then I suggest that, instead of taking random samples, you numerically integrate moments of your newly-made pdf to find the mean and variance.
Alan Weiss
MATLAB mathematical toolbox documentation
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!